lkml.org 
[lkml]   [2021]   [Dec]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] ASoC: wm8962: potential use of error pointer
On Fri, Dec 17, 2021 at 11:13:33AM +0800, Jiasheng Jiang wrote:
> The return value of devm_clk_get() needs to be checked.
> To avoid use of error pointer in case of the failure of alloc.
>
> Fixes: d74e9e7090ae ("ASoC: wm8962: Add device tree binding")
> Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
> ---
> sound/soc/codecs/wm8962.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/sound/soc/codecs/wm8962.c b/sound/soc/codecs/wm8962.c
> index 34080f497584..66693bf17763 100644
> --- a/sound/soc/codecs/wm8962.c
> +++ b/sound/soc/codecs/wm8962.c
> @@ -3540,6 +3540,8 @@ static int wm8962_set_pdata_from_of(struct i2c_client *i2c,
> }
>
> pdata->mclk = devm_clk_get(&i2c->dev, NULL);
> + if (IS_ERR(pdata->mclk))
> + return -ENOMEM;

The value was checked later, so the code was mostly fine and what
bugs there were have already been fixed:

044c11401443 ("ASoC: wm8962: Convert to devm_clk_get_optional")

Thanks,
Charles

\
 
 \ /
  Last update: 2021-12-17 10:48    [W:0.050 / U:0.172 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site