All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wan Jiabing <wanjiabing@vivo.com>
To: Vinod Koul <vkoul@kernel.org>, Orson Zhai <orsonzhai@gmail.com>,
	Baolin Wang <baolin.wang7@gmail.com>,
	Chunyan Zhang <zhang.lyra@gmail.com>,
	Linus Walleij <linus.walleij@linaro.org>,
	dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org
Cc: Wan Jiabing <wanjiabing@vivo.com>
Subject: [PATCH 3/4] dmaengine: ste_dma40: Remove unneeded ERROR and NULL check in ste_dma40
Date: Mon, 16 May 2022 16:41:38 +0800	[thread overview]
Message-ID: <20220516084139.8864-4-wanjiabing@vivo.com> (raw)
In-Reply-To: <20220516084139.8864-1-wanjiabing@vivo.com>

clk_put() already checks ERROR by using IS_ERR.
clk_disable_unprepare() already checks NULL by using IS_ERR_OR_NULL.
Remove unneeded NULL check for clk_ret and ERROR check for clk.

Signed-off-by: Wan Jiabing <wanjiabing@vivo.com>
---
 drivers/dma/ste_dma40.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/dma/ste_dma40.c b/drivers/dma/ste_dma40.c
index e1827393143f..7d1bf4ae4495 100644
--- a/drivers/dma/ste_dma40.c
+++ b/drivers/dma/ste_dma40.c
@@ -3119,7 +3119,7 @@ static struct d40_base * __init d40_hw_detect_init(struct platform_device *pdev)
 	clk = clk_get(&pdev->dev, NULL);
 	if (IS_ERR(clk)) {
 		d40_err(&pdev->dev, "No matching clock found\n");
-		goto check_prepare_enabled;
+		goto disable_unprepare;
 	}
 
 	clk_ret = clk_prepare_enable(clk);
@@ -3305,12 +3305,10 @@ static struct d40_base * __init d40_hw_detect_init(struct platform_device *pdev)
 	iounmap(virtbase);
  release_region:
 	release_mem_region(res->start, resource_size(res));
- check_prepare_enabled:
-	if (!clk_ret)
  disable_unprepare:
-		clk_disable_unprepare(clk);
-	if (!IS_ERR(clk))
-		clk_put(clk);
+	clk_disable_unprepare(clk);
+	clk_put(clk);
+
 	return NULL;
 }
 
-- 
2.36.1


WARNING: multiple messages have this Message-ID (diff)
From: Wan Jiabing <wanjiabing@vivo.com>
To: Vinod Koul <vkoul@kernel.org>, Orson Zhai <orsonzhai@gmail.com>,
	Baolin Wang <baolin.wang7@gmail.com>,
	Chunyan Zhang <zhang.lyra@gmail.com>,
	Linus Walleij <linus.walleij@linaro.org>,
	dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org
Cc: Wan Jiabing <wanjiabing@vivo.com>
Subject: [PATCH 3/4] dmaengine: ste_dma40: Remove unneeded ERROR and NULL check in ste_dma40
Date: Mon, 16 May 2022 16:41:38 +0800	[thread overview]
Message-ID: <20220516084139.8864-4-wanjiabing@vivo.com> (raw)
In-Reply-To: <20220516084139.8864-1-wanjiabing@vivo.com>

clk_put() already checks ERROR by using IS_ERR.
clk_disable_unprepare() already checks NULL by using IS_ERR_OR_NULL.
Remove unneeded NULL check for clk_ret and ERROR check for clk.

Signed-off-by: Wan Jiabing <wanjiabing@vivo.com>
---
 drivers/dma/ste_dma40.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/dma/ste_dma40.c b/drivers/dma/ste_dma40.c
index e1827393143f..7d1bf4ae4495 100644
--- a/drivers/dma/ste_dma40.c
+++ b/drivers/dma/ste_dma40.c
@@ -3119,7 +3119,7 @@ static struct d40_base * __init d40_hw_detect_init(struct platform_device *pdev)
 	clk = clk_get(&pdev->dev, NULL);
 	if (IS_ERR(clk)) {
 		d40_err(&pdev->dev, "No matching clock found\n");
-		goto check_prepare_enabled;
+		goto disable_unprepare;
 	}
 
 	clk_ret = clk_prepare_enable(clk);
@@ -3305,12 +3305,10 @@ static struct d40_base * __init d40_hw_detect_init(struct platform_device *pdev)
 	iounmap(virtbase);
  release_region:
 	release_mem_region(res->start, resource_size(res));
- check_prepare_enabled:
-	if (!clk_ret)
  disable_unprepare:
-		clk_disable_unprepare(clk);
-	if (!IS_ERR(clk))
-		clk_put(clk);
+	clk_disable_unprepare(clk);
+	clk_put(clk);
+
 	return NULL;
 }
 
-- 
2.36.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2022-05-16  8:43 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-16  8:41 [PATCH 0/4] dmaengine: Remove unneeded ERROR checks before clk_xxx Wan Jiabing
2022-05-16  8:41 ` Wan Jiabing
2022-05-16  8:41 ` [PATCH 1/4] dmaengine: ep93xx_dma: Remove unneeded ERROR check before clk_put Wan Jiabing
2022-05-16  8:41   ` Wan Jiabing
2022-05-18  7:12   ` Krzysztof Kozlowski
2022-05-18  7:12     ` Krzysztof Kozlowski
2022-05-16  8:41 ` [PATCH 2/4] dmaengine: sprd-dma: Remove unneeded ERROR check before clk_disable_unprepare Wan Jiabing
2022-05-16  8:41   ` Wan Jiabing
2022-05-17 15:13   ` Krzysztof Kozlowski
2022-05-17 15:13     ` Krzysztof Kozlowski
2022-05-18  2:44     ` Jiabing Wan
2022-05-18  2:44       ` Jiabing Wan
2022-05-18  7:10       ` Krzysztof Kozlowski
2022-05-18  7:10         ` Krzysztof Kozlowski
2022-05-18  7:12   ` Krzysztof Kozlowski
2022-05-18  7:12     ` Krzysztof Kozlowski
2022-05-16  8:41 ` Wan Jiabing [this message]
2022-05-16  8:41   ` [PATCH 3/4] dmaengine: ste_dma40: Remove unneeded ERROR and NULL check in ste_dma40 Wan Jiabing
2022-05-18  7:15   ` Krzysztof Kozlowski
2022-05-18  7:15     ` Krzysztof Kozlowski
2022-05-19  6:34     ` Jiabing Wan
2022-05-19  6:34       ` Jiabing Wan
2022-05-16  8:41 ` [PATCH 4/4] dmaengine: xgene-dma: Remove unneeded ERROR check before clk_disable_unprepare Wan Jiabing
2022-05-16  8:41   ` Wan Jiabing

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220516084139.8864-4-wanjiabing@vivo.com \
    --to=wanjiabing@vivo.com \
    --cc=baolin.wang7@gmail.com \
    --cc=dmaengine@vger.kernel.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=orsonzhai@gmail.com \
    --cc=vkoul@kernel.org \
    --cc=zhang.lyra@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.