[PATCH] ASoC: adau17x1: Remove redundant null check before clk_disable_unprepare

Sa, Nuno Nuno.Sa at analog.com
Fri Jan 8 10:19:55 CET 2021


> -----Original Message-----
> From: Xu Wang <vulab at iscas.ac.cn>
> Sent: Friday, January 8, 2021 9:45 AM
> To: lars at metafoo.de; Sa, Nuno <Nuno.Sa at analog.com>;
> lgirdwood at gmail.com; broonie at kernel.org; perex at perex.cz;
> tiwai at suse.com; alsa-devel at alsa-project.org
> Cc: linux-kernel at vger.kernel.org
> Subject: [PATCH] ASoC: adau17x1: Remove redundant null check
> before clk_disable_unprepare
> 
> 
> Because clk_disable_unprepare() already checked NULL clock
> parameter,
> so the additional check is unnecessary, just remove it.
> 
> Signed-off-by: Xu Wang <vulab at iscas.ac.cn>
> ---
>  sound/soc/codecs/adau17x1.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/sound/soc/codecs/adau17x1.c
> b/sound/soc/codecs/adau17x1.c
> index 30e072c80ac1..546ee8178038 100644
> --- a/sound/soc/codecs/adau17x1.c
> +++ b/sound/soc/codecs/adau17x1.c
> @@ -1095,8 +1095,7 @@ void adau17x1_remove(struct device *dev)
>  {
>  	struct adau *adau = dev_get_drvdata(dev);
> 
> -	if (adau->mclk)
> -		clk_disable_unprepare(adau->mclk);
> +	clk_disable_unprepare(adau->mclk);
>  }
>  EXPORT_SYMBOL_GPL(adau17x1_remove);

This is fine by me but since you are touching this, you could also just replace the
remove() hook in all the users with devm_add_action_or_reset().

- Nuno Sá


More information about the Alsa-devel mailing list