diff mbox series

[2/4] dmaengine: sprd-dma: Remove unneeded ERROR check before clk_disable_unprepare

Message ID 20220516084139.8864-3-wanjiabing@vivo.com (mailing list archive)
State Changes Requested
Headers show
Series dmaengine: Remove unneeded ERROR checks before clk_xxx | expand

Commit Message

Jiabing Wan May 16, 2022, 8:41 a.m. UTC
clk_disable_unprepare() already checks ERROR by using IS_ERR_OR_NULL.
Remove unneeded ERROR check for sdev->ashb_clk.

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

Comments

Krzysztof Kozlowski May 17, 2022, 3:13 p.m. UTC | #1
On 16/05/2022 10:41, Wan Jiabing wrote:
> clk_disable_unprepare() already checks ERROR by using IS_ERR_OR_NULL.

Hmm, maybe I am looking at different sources, but which commit
introduced IS_ERR_OR_NULL() check? Where is it in the sources?



Best regards,
Krzysztof
Jiabing Wan May 18, 2022, 2:44 a.m. UTC | #2
Hi,

On 2022/5/17 23:13, Krzysztof Kozlowski wrote:
> On 16/05/2022 10:41, Wan Jiabing wrote:
>> clk_disable_unprepare() already checks ERROR by using IS_ERR_OR_NULL.
> Hmm, maybe I am looking at different sources, but which commit
> introduced IS_ERR_OR_NULL() check? Where is it in the sources?
>
In commit 4dff95dc9477a, IS_ERR_OR_NULL check is added in clk_disable() 
and clk_unprepare().
And clk_disable_unprepare() just calls clk_disable() and clk_unprepare():

static inline void clk_disable_unprepare(struct clk *clk)
{
      clk_disable(clk);
      clk_unprepare(clk);
}
>
> Best regards,
> Krzysztof

Thanks,
Wan Jiabing
Krzysztof Kozlowski May 18, 2022, 7:10 a.m. UTC | #3
On 18/05/2022 04:44, Jiabing Wan wrote:
> Hi,
> 
> On 2022/5/17 23:13, Krzysztof Kozlowski wrote:
>> On 16/05/2022 10:41, Wan Jiabing wrote:
>>> clk_disable_unprepare() already checks ERROR by using IS_ERR_OR_NULL.
>> Hmm, maybe I am looking at different sources, but which commit
>> introduced IS_ERR_OR_NULL() check? Where is it in the sources?
>>
> In commit 4dff95dc9477a, IS_ERR_OR_NULL check is added in clk_disable() 
> and clk_unprepare().
> And clk_disable_unprepare() just calls clk_disable() and clk_unprepare():

Thank you, indeed, I was mislead a bit by clk_prepare() which is not
symmetric.



Best regards,
Krzysztof
Krzysztof Kozlowski May 18, 2022, 7:12 a.m. UTC | #4
On 16/05/2022 10:41, Wan Jiabing wrote:
> clk_disable_unprepare() already checks ERROR by using IS_ERR_OR_NULL.
> Remove unneeded ERROR check for sdev->ashb_clk.
> 
> Signed-off-by: Wan Jiabing <wanjiabing@vivo.com>


Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>


Best regards,
Krzysztof
diff mbox series

Patch

diff --git a/drivers/dma/sprd-dma.c b/drivers/dma/sprd-dma.c
index 7f158ef5672d..bf5ad879b5e2 100644
--- a/drivers/dma/sprd-dma.c
+++ b/drivers/dma/sprd-dma.c
@@ -279,12 +279,7 @@  static int sprd_dma_enable(struct sprd_dma_dev *sdev)
 static void sprd_dma_disable(struct sprd_dma_dev *sdev)
 {
 	clk_disable_unprepare(sdev->clk);
-
-	/*
-	 * Need to check if we need disable the optional ashb_clk for AGCP DMA.
-	 */
-	if (!IS_ERR(sdev->ashb_clk))
-		clk_disable_unprepare(sdev->ashb_clk);
+	clk_disable_unprepare(sdev->ashb_clk);
 }
 
 static void sprd_dma_set_uid(struct sprd_dma_chn *schan)