diff mbox series

ASoC: fsl: Check before clk_put() not needed

Message ID 20220601131429.9794-1-hanyihao@vivo.com (mailing list archive)
State New, archived
Headers show
Series ASoC: fsl: Check before clk_put() not needed | expand

Commit Message

Yihao Han June 1, 2022, 1:14 p.m. UTC
clk_put() already checks the clk ptr using !clk and IS_ERR()
so there is no need to check it again before calling it.

Signed-off-by: Yihao Han <hanyihao@vivo.com>
---
 sound/soc/fsl/imx-sgtl5000.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Sascha Hauer June 1, 2022, 1:22 p.m. UTC | #1
On Wed, Jun 01, 2022 at 06:14:29AM -0700, Yihao Han wrote:
> clk_put() already checks the clk ptr using !clk and IS_ERR()
> so there is no need to check it again before calling it.
> 
> Signed-off-by: Yihao Han <hanyihao@vivo.com>
> ---
>  sound/soc/fsl/imx-sgtl5000.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/sound/soc/fsl/imx-sgtl5000.c b/sound/soc/fsl/imx-sgtl5000.c
> index 580a0d963f0e..16a281820186 100644
> --- a/sound/soc/fsl/imx-sgtl5000.c
> +++ b/sound/soc/fsl/imx-sgtl5000.c
> @@ -185,8 +185,7 @@ static int imx_sgtl5000_probe(struct platform_device *pdev)
>  put_device:
>  	put_device(&codec_dev->dev);
>  fail:
> -	if (data && !IS_ERR(data->codec_clk))
> -		clk_put(data->codec_clk);
> +	clk_put(data->codec_clk);

The fail label is used before data is initialized, so the if (data)
check is really needed.

Sascha
diff mbox series

Patch

diff --git a/sound/soc/fsl/imx-sgtl5000.c b/sound/soc/fsl/imx-sgtl5000.c
index 580a0d963f0e..16a281820186 100644
--- a/sound/soc/fsl/imx-sgtl5000.c
+++ b/sound/soc/fsl/imx-sgtl5000.c
@@ -185,8 +185,7 @@  static int imx_sgtl5000_probe(struct platform_device *pdev)
 put_device:
 	put_device(&codec_dev->dev);
 fail:
-	if (data && !IS_ERR(data->codec_clk))
-		clk_put(data->codec_clk);
+	clk_put(data->codec_clk);
 	of_node_put(ssi_np);
 	of_node_put(codec_np);