[PATCH] ASoC: ti: omap-dmic: Fix IS_ERR() vs NULL check bug in omap_dmic_select_fclk()

Ingyu Jang posted 1 patch 4 weeks ago
sound/soc/ti/omap-dmic.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] ASoC: ti: omap-dmic: Fix IS_ERR() vs NULL check bug in omap_dmic_select_fclk()
Posted by Ingyu Jang 4 weeks ago
clk_get_parent() returns NULL when the clock has no parent (or when the
input clk is NULL); it never returns an ERR_PTR. The current IS_ERR(mux)
check therefore never triggers - a NULL return falls through silently
to clk_set_parent(NULL, parent_clk), which simply fails with -EINVAL.

Use a NULL check so the dedicated error path runs and the prior
clk_get() reference is released via clk_put().

Signed-off-by: Ingyu Jang <ingyujang25@korea.ac.kr>
---
 sound/soc/ti/omap-dmic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/ti/omap-dmic.c b/sound/soc/ti/omap-dmic.c
index fb92bb88eb5c2..f6c393c9489d6 100644
--- a/sound/soc/ti/omap-dmic.c
+++ b/sound/soc/ti/omap-dmic.c
@@ -328,7 +328,7 @@ static int omap_dmic_select_fclk(struct omap_dmic *dmic, int clk_id,
 	}
 
 	mux = clk_get_parent(dmic->fclk);
-	if (IS_ERR(mux)) {
+	if (!mux) {
 		dev_err(dmic->dev, "can't get fck mux parent\n");
 		clk_put(parent_clk);
 		return -ENODEV;
-- 
2.34.1
Re: [PATCH] ASoC: ti: omap-dmic: Fix IS_ERR() vs NULL check bug in omap_dmic_select_fclk()
Posted by Mark Brown 4 weeks ago
On Fri, 15 May 2026 03:52:15 +0900, Ingyu Jang wrote:
> ASoC: ti: omap-dmic: Fix IS_ERR() vs NULL check bug in omap_dmic_select_fclk()

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-7.1

Thanks!

[1/1] ASoC: ti: omap-dmic: Fix IS_ERR() vs NULL check bug in omap_dmic_select_fclk()
      https://git.kernel.org/broonie/sound/c/c996a4418dd4

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark
Re: [PATCH] ASoC: ti: omap-dmic: Fix IS_ERR() vs NULL check bug in omap_dmic_select_fclk()
Posted by Wang, Sen 4 weeks ago
On 5/14/2026 1:52 PM, Ingyu Jang wrote:
> clk_get_parent() returns NULL when the clock has no parent (or when the
> input clk is NULL); it never returns an ERR_PTR. The current IS_ERR(mux)
> check therefore never triggers - a NULL return falls through silently
> to clk_set_parent(NULL, parent_clk), which simply fails with -EINVAL.
> 
> Use a NULL check so the dedicated error path runs and the prior
> clk_get() reference is released via clk_put().
> 
> Signed-off-by: Ingyu Jang <ingyujang25@korea.ac.kr>
> ---
>   sound/soc/ti/omap-dmic.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/sound/soc/ti/omap-dmic.c b/sound/soc/ti/omap-dmic.c
> index fb92bb88eb5c2..f6c393c9489d6 100644
> --- a/sound/soc/ti/omap-dmic.c
> +++ b/sound/soc/ti/omap-dmic.c
> @@ -328,7 +328,7 @@ static int omap_dmic_select_fclk(struct omap_dmic *dmic, int clk_id,
>   	}
>   
>   	mux = clk_get_parent(dmic->fclk);
> -	if (IS_ERR(mux)) {
> +	if (!mux) {
>   		dev_err(dmic->dev, "can't get fck mux parent\n");
>   		clk_put(parent_clk);
>   		return -ENODEV;

Hi Ingyu,

looks good to me, thanks for the patch.

Acked-by: Sen Wang <sen@ti.com>

Best,
Sen Wang