[PATCH] ASoC: sun8i-codec: Remove unnecessary NULL check before clk_disable_unprepare()

Chen Ni posted 1 patch 8 months, 3 weeks ago
sound/soc/sunxi/sun8i-codec.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
[PATCH] ASoC: sun8i-codec: Remove unnecessary NULL check before clk_disable_unprepare()
Posted by Chen Ni 8 months, 3 weeks ago
clk_disable_unprepare() already checks NULL by using IS_ERR_OR_NULL.
Remove unneeded NULL check for clk here.

Signed-off-by: Chen Ni <nichen@iscas.ac.cn>
---
 sound/soc/sunxi/sun8i-codec.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/sound/soc/sunxi/sun8i-codec.c b/sound/soc/sunxi/sun8i-codec.c
index 8b9eb1a202f7..a27976c375fe 100644
--- a/sound/soc/sunxi/sun8i-codec.c
+++ b/sound/soc/sunxi/sun8i-codec.c
@@ -274,8 +274,7 @@ static int sun8i_codec_runtime_suspend(struct device *dev)
 	regcache_cache_only(scodec->regmap, true);
 	regcache_mark_dirty(scodec->regmap);
 
-	if (scodec->clk_bus)
-		clk_disable_unprepare(scodec->clk_bus);
+	clk_disable_unprepare(scodec->clk_bus);
 
 	return 0;
 }
-- 
2.25.1
Re: [PATCH] ASoC: sun8i-codec: Remove unnecessary NULL check before clk_disable_unprepare()
Posted by Chen-Yu Tsai 8 months, 3 weeks ago
On Tue, Mar 25, 2025 at 11:29 AM Chen Ni <nichen@iscas.ac.cn> wrote:
>
> clk_disable_unprepare() already checks NULL by using IS_ERR_OR_NULL.
> Remove unneeded NULL check for clk here.

Please also clean up the clk_prepare_enable() call.

ChenYu

> Signed-off-by: Chen Ni <nichen@iscas.ac.cn>
> ---
>  sound/soc/sunxi/sun8i-codec.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/sound/soc/sunxi/sun8i-codec.c b/sound/soc/sunxi/sun8i-codec.c
> index 8b9eb1a202f7..a27976c375fe 100644
> --- a/sound/soc/sunxi/sun8i-codec.c
> +++ b/sound/soc/sunxi/sun8i-codec.c
> @@ -274,8 +274,7 @@ static int sun8i_codec_runtime_suspend(struct device *dev)
>         regcache_cache_only(scodec->regmap, true);
>         regcache_mark_dirty(scodec->regmap);
>
> -       if (scodec->clk_bus)
> -               clk_disable_unprepare(scodec->clk_bus);
> +       clk_disable_unprepare(scodec->clk_bus);
>
>         return 0;
>  }
> --
> 2.25.1
>
>