* [PATCH 0/4] dmaengine: Remove unneeded ERROR checks before clk_xxx
@ 2022-05-16 8:41 ` Wan Jiabing
0 siblings, 0 replies; 24+ messages in thread
From: Wan Jiabing @ 2022-05-16 8:41 UTC (permalink / raw)
To: Vinod Koul, Orson Zhai, Baolin Wang, Chunyan Zhang,
Linus Walleij, dmaengine, linux-kernel, linux-arm-kernel
Cc: Wan Jiabing
This patch set tries to remove unneeded ERROR check before clk_xxx.
clk_put() already uses !clk and IS_ERR(clk) to check ERROR or NULL.
clk_disable_unprepare() already checks ERROR by using IS_ERR_OR_NULL.
Remove unneeded ERROR or NULL check before them.
Wan Jiabing (4):
dmaengine: ep93xx_dma: Remove unneeded ERROR check before clk_put
dmaengine: sprd-dma: Remove unneeded ERROR check before clk_disable_unprepare
dmaengine: ste_dma40: Remove unneeded ERROR and NULL check in ste_dma40
dmaengine: xgene-dma: Remove unneeded ERROR check before clk_disable_unprepare
drivers/dma/ep93xx_dma.c | 3 +--
drivers/dma/sprd-dma.c | 7 +------
drivers/dma/ste_dma40.c | 10 ++++------
drivers/dma/xgene-dma.c | 6 ++----
4 files changed, 8 insertions(+), 18 deletions(-)
--
2.36.1
^ permalink raw reply [flat|nested] 24+ messages in thread
* [PATCH 0/4] dmaengine: Remove unneeded ERROR checks before clk_xxx
@ 2022-05-16 8:41 ` Wan Jiabing
0 siblings, 0 replies; 24+ messages in thread
From: Wan Jiabing @ 2022-05-16 8:41 UTC (permalink / raw)
To: Vinod Koul, Orson Zhai, Baolin Wang, Chunyan Zhang,
Linus Walleij, dmaengine, linux-kernel, linux-arm-kernel
Cc: Wan Jiabing
This patch set tries to remove unneeded ERROR check before clk_xxx.
clk_put() already uses !clk and IS_ERR(clk) to check ERROR or NULL.
clk_disable_unprepare() already checks ERROR by using IS_ERR_OR_NULL.
Remove unneeded ERROR or NULL check before them.
Wan Jiabing (4):
dmaengine: ep93xx_dma: Remove unneeded ERROR check before clk_put
dmaengine: sprd-dma: Remove unneeded ERROR check before clk_disable_unprepare
dmaengine: ste_dma40: Remove unneeded ERROR and NULL check in ste_dma40
dmaengine: xgene-dma: Remove unneeded ERROR check before clk_disable_unprepare
drivers/dma/ep93xx_dma.c | 3 +--
drivers/dma/sprd-dma.c | 7 +------
drivers/dma/ste_dma40.c | 10 ++++------
drivers/dma/xgene-dma.c | 6 ++----
4 files changed, 8 insertions(+), 18 deletions(-)
--
2.36.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 24+ messages in thread
* [PATCH 1/4] dmaengine: ep93xx_dma: Remove unneeded ERROR check before clk_put
2022-05-16 8:41 ` Wan Jiabing
@ 2022-05-16 8:41 ` Wan Jiabing
-1 siblings, 0 replies; 24+ messages in thread
From: Wan Jiabing @ 2022-05-16 8:41 UTC (permalink / raw)
To: Vinod Koul, Orson Zhai, Baolin Wang, Chunyan Zhang,
Linus Walleij, dmaengine, linux-kernel, linux-arm-kernel
Cc: Wan Jiabing
clk_put() already uses !clk and IS_ERR(clk) to check ERROR or NULL.
Remove unneeded ERROR or NULL check for edmac->clk.
Signed-off-by: Wan Jiabing <wanjiabing@vivo.com>
---
drivers/dma/ep93xx_dma.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/dma/ep93xx_dma.c b/drivers/dma/ep93xx_dma.c
index 971ff5f9ae84..60dc7b3f3d0d 100644
--- a/drivers/dma/ep93xx_dma.c
+++ b/drivers/dma/ep93xx_dma.c
@@ -1398,8 +1398,7 @@ static int __init ep93xx_dma_probe(struct platform_device *pdev)
if (unlikely(ret)) {
for (i = 0; i < edma->num_channels; i++) {
struct ep93xx_dma_chan *edmac = &edma->channels[i];
- if (!IS_ERR_OR_NULL(edmac->clk))
- clk_put(edmac->clk);
+ clk_put(edmac->clk);
}
kfree(edma);
} else {
--
2.36.1
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH 1/4] dmaengine: ep93xx_dma: Remove unneeded ERROR check before clk_put
@ 2022-05-16 8:41 ` Wan Jiabing
0 siblings, 0 replies; 24+ messages in thread
From: Wan Jiabing @ 2022-05-16 8:41 UTC (permalink / raw)
To: Vinod Koul, Orson Zhai, Baolin Wang, Chunyan Zhang,
Linus Walleij, dmaengine, linux-kernel, linux-arm-kernel
Cc: Wan Jiabing
clk_put() already uses !clk and IS_ERR(clk) to check ERROR or NULL.
Remove unneeded ERROR or NULL check for edmac->clk.
Signed-off-by: Wan Jiabing <wanjiabing@vivo.com>
---
drivers/dma/ep93xx_dma.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/dma/ep93xx_dma.c b/drivers/dma/ep93xx_dma.c
index 971ff5f9ae84..60dc7b3f3d0d 100644
--- a/drivers/dma/ep93xx_dma.c
+++ b/drivers/dma/ep93xx_dma.c
@@ -1398,8 +1398,7 @@ static int __init ep93xx_dma_probe(struct platform_device *pdev)
if (unlikely(ret)) {
for (i = 0; i < edma->num_channels; i++) {
struct ep93xx_dma_chan *edmac = &edma->channels[i];
- if (!IS_ERR_OR_NULL(edmac->clk))
- clk_put(edmac->clk);
+ clk_put(edmac->clk);
}
kfree(edma);
} else {
--
2.36.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH 2/4] dmaengine: sprd-dma: Remove unneeded ERROR check before clk_disable_unprepare
2022-05-16 8:41 ` Wan Jiabing
@ 2022-05-16 8:41 ` Wan Jiabing
-1 siblings, 0 replies; 24+ messages in thread
From: Wan Jiabing @ 2022-05-16 8:41 UTC (permalink / raw)
To: Vinod Koul, Orson Zhai, Baolin Wang, Chunyan Zhang,
Linus Walleij, dmaengine, linux-kernel, linux-arm-kernel
Cc: Wan Jiabing
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(-)
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)
--
2.36.1
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH 2/4] dmaengine: sprd-dma: Remove unneeded ERROR check before clk_disable_unprepare
@ 2022-05-16 8:41 ` Wan Jiabing
0 siblings, 0 replies; 24+ messages in thread
From: Wan Jiabing @ 2022-05-16 8:41 UTC (permalink / raw)
To: Vinod Koul, Orson Zhai, Baolin Wang, Chunyan Zhang,
Linus Walleij, dmaengine, linux-kernel, linux-arm-kernel
Cc: Wan Jiabing
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(-)
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)
--
2.36.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH 3/4] dmaengine: ste_dma40: Remove unneeded ERROR and NULL check in ste_dma40
2022-05-16 8:41 ` Wan Jiabing
@ 2022-05-16 8:41 ` Wan Jiabing
-1 siblings, 0 replies; 24+ messages in thread
From: Wan Jiabing @ 2022-05-16 8:41 UTC (permalink / raw)
To: Vinod Koul, Orson Zhai, Baolin Wang, Chunyan Zhang,
Linus Walleij, dmaengine, linux-kernel, linux-arm-kernel
Cc: Wan Jiabing
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
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH 3/4] dmaengine: ste_dma40: Remove unneeded ERROR and NULL check in ste_dma40
@ 2022-05-16 8:41 ` Wan Jiabing
0 siblings, 0 replies; 24+ messages in thread
From: Wan Jiabing @ 2022-05-16 8:41 UTC (permalink / raw)
To: Vinod Koul, Orson Zhai, Baolin Wang, Chunyan Zhang,
Linus Walleij, dmaengine, linux-kernel, linux-arm-kernel
Cc: Wan Jiabing
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
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH 4/4] dmaengine: xgene-dma: Remove unneeded ERROR check before clk_disable_unprepare
2022-05-16 8:41 ` Wan Jiabing
@ 2022-05-16 8:41 ` Wan Jiabing
-1 siblings, 0 replies; 24+ messages in thread
From: Wan Jiabing @ 2022-05-16 8:41 UTC (permalink / raw)
To: Vinod Koul, Orson Zhai, Baolin Wang, Chunyan Zhang,
Linus Walleij, dmaengine, linux-kernel, linux-arm-kernel
Cc: Wan Jiabing
clk_disable_unprepare() already checks ERROR by using IS_ERR_OR_NULL.
Remove unneeded ERROR check for pdma->clk.
Signed-off-by: Wan Jiabing <wanjiabing@vivo.com>
---
drivers/dma/xgene-dma.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/dma/xgene-dma.c b/drivers/dma/xgene-dma.c
index 3589b4ef50b8..7f0088b09714 100644
--- a/drivers/dma/xgene-dma.c
+++ b/drivers/dma/xgene-dma.c
@@ -1769,8 +1769,7 @@ static int xgene_dma_probe(struct platform_device *pdev)
err_dma_mask:
err_clk_enable:
- if (!IS_ERR(pdma->clk))
- clk_disable_unprepare(pdma->clk);
+ clk_disable_unprepare(pdma->clk);
return ret;
}
@@ -1794,8 +1793,7 @@ static int xgene_dma_remove(struct platform_device *pdev)
xgene_dma_delete_chan_rings(chan);
}
- if (!IS_ERR(pdma->clk))
- clk_disable_unprepare(pdma->clk);
+ clk_disable_unprepare(pdma->clk);
return 0;
}
--
2.36.1
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH 4/4] dmaengine: xgene-dma: Remove unneeded ERROR check before clk_disable_unprepare
@ 2022-05-16 8:41 ` Wan Jiabing
0 siblings, 0 replies; 24+ messages in thread
From: Wan Jiabing @ 2022-05-16 8:41 UTC (permalink / raw)
To: Vinod Koul, Orson Zhai, Baolin Wang, Chunyan Zhang,
Linus Walleij, dmaengine, linux-kernel, linux-arm-kernel
Cc: Wan Jiabing
clk_disable_unprepare() already checks ERROR by using IS_ERR_OR_NULL.
Remove unneeded ERROR check for pdma->clk.
Signed-off-by: Wan Jiabing <wanjiabing@vivo.com>
---
drivers/dma/xgene-dma.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/dma/xgene-dma.c b/drivers/dma/xgene-dma.c
index 3589b4ef50b8..7f0088b09714 100644
--- a/drivers/dma/xgene-dma.c
+++ b/drivers/dma/xgene-dma.c
@@ -1769,8 +1769,7 @@ static int xgene_dma_probe(struct platform_device *pdev)
err_dma_mask:
err_clk_enable:
- if (!IS_ERR(pdma->clk))
- clk_disable_unprepare(pdma->clk);
+ clk_disable_unprepare(pdma->clk);
return ret;
}
@@ -1794,8 +1793,7 @@ static int xgene_dma_remove(struct platform_device *pdev)
xgene_dma_delete_chan_rings(chan);
}
- if (!IS_ERR(pdma->clk))
- clk_disable_unprepare(pdma->clk);
+ clk_disable_unprepare(pdma->clk);
return 0;
}
--
2.36.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 24+ messages in thread
* Re: [PATCH 2/4] dmaengine: sprd-dma: Remove unneeded ERROR check before clk_disable_unprepare
2022-05-16 8:41 ` Wan Jiabing
@ 2022-05-17 15:13 ` Krzysztof Kozlowski
-1 siblings, 0 replies; 24+ messages in thread
From: Krzysztof Kozlowski @ 2022-05-17 15:13 UTC (permalink / raw)
To: Wan Jiabing, Vinod Koul, Orson Zhai, Baolin Wang, Chunyan Zhang,
Linus Walleij, dmaengine, linux-kernel, linux-arm-kernel
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
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH 2/4] dmaengine: sprd-dma: Remove unneeded ERROR check before clk_disable_unprepare
@ 2022-05-17 15:13 ` Krzysztof Kozlowski
0 siblings, 0 replies; 24+ messages in thread
From: Krzysztof Kozlowski @ 2022-05-17 15:13 UTC (permalink / raw)
To: Wan Jiabing, Vinod Koul, Orson Zhai, Baolin Wang, Chunyan Zhang,
Linus Walleij, dmaengine, linux-kernel, linux-arm-kernel
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
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH 2/4] dmaengine: sprd-dma: Remove unneeded ERROR check before clk_disable_unprepare
2022-05-17 15:13 ` Krzysztof Kozlowski
@ 2022-05-18 2:44 ` Jiabing Wan
-1 siblings, 0 replies; 24+ messages in thread
From: Jiabing Wan @ 2022-05-18 2:44 UTC (permalink / raw)
To: Krzysztof Kozlowski, Vinod Koul, Orson Zhai, Baolin Wang,
Chunyan Zhang, Linus Walleij, dmaengine, linux-kernel,
linux-arm-kernel
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
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH 2/4] dmaengine: sprd-dma: Remove unneeded ERROR check before clk_disable_unprepare
@ 2022-05-18 2:44 ` Jiabing Wan
0 siblings, 0 replies; 24+ messages in thread
From: Jiabing Wan @ 2022-05-18 2:44 UTC (permalink / raw)
To: Krzysztof Kozlowski, Vinod Koul, Orson Zhai, Baolin Wang,
Chunyan Zhang, Linus Walleij, dmaengine, linux-kernel,
linux-arm-kernel
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
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH 2/4] dmaengine: sprd-dma: Remove unneeded ERROR check before clk_disable_unprepare
2022-05-18 2:44 ` Jiabing Wan
@ 2022-05-18 7:10 ` Krzysztof Kozlowski
-1 siblings, 0 replies; 24+ messages in thread
From: Krzysztof Kozlowski @ 2022-05-18 7:10 UTC (permalink / raw)
To: Jiabing Wan, Vinod Koul, Orson Zhai, Baolin Wang, Chunyan Zhang,
Linus Walleij, dmaengine, linux-kernel, linux-arm-kernel
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
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH 2/4] dmaengine: sprd-dma: Remove unneeded ERROR check before clk_disable_unprepare
@ 2022-05-18 7:10 ` Krzysztof Kozlowski
0 siblings, 0 replies; 24+ messages in thread
From: Krzysztof Kozlowski @ 2022-05-18 7:10 UTC (permalink / raw)
To: Jiabing Wan, Vinod Koul, Orson Zhai, Baolin Wang, Chunyan Zhang,
Linus Walleij, dmaengine, linux-kernel, linux-arm-kernel
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
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH 1/4] dmaengine: ep93xx_dma: Remove unneeded ERROR check before clk_put
2022-05-16 8:41 ` Wan Jiabing
@ 2022-05-18 7:12 ` Krzysztof Kozlowski
-1 siblings, 0 replies; 24+ messages in thread
From: Krzysztof Kozlowski @ 2022-05-18 7:12 UTC (permalink / raw)
To: Wan Jiabing, Vinod Koul, Orson Zhai, Baolin Wang, Chunyan Zhang,
Linus Walleij, dmaengine, linux-kernel, linux-arm-kernel
On 16/05/2022 10:41, Wan Jiabing wrote:
> clk_put() already uses !clk and IS_ERR(clk) to check ERROR or NULL.
> Remove unneeded ERROR or NULL check for edmac->clk.
>
> Signed-off-by: Wan Jiabing <wanjiabing@vivo.com>
> ---
> drivers/dma/ep93xx_dma.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/dma/ep93xx_dma.c b/drivers/dma/ep93xx_dma.c
> index 971ff5f9ae84..60dc7b3f3d0d 100644
> --- a/drivers/dma/ep93xx_dma.c
> +++ b/drivers/dma/ep93xx_dma.c
> @@ -1398,8 +1398,7 @@ static int __init ep93xx_dma_probe(struct platform_device *pdev)
> if (unlikely(ret)) {
> for (i = 0; i < edma->num_channels; i++) {
> struct ep93xx_dma_chan *edmac = &edma->channels[i];
> - if (!IS_ERR_OR_NULL(edmac->clk))
> - clk_put(edmac->clk);
> + clk_put(edmac->clk);
clk_put() which calls __clk_put() seems to print warning on IS_ERR, so
this does not look equivalent code.
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH 1/4] dmaengine: ep93xx_dma: Remove unneeded ERROR check before clk_put
@ 2022-05-18 7:12 ` Krzysztof Kozlowski
0 siblings, 0 replies; 24+ messages in thread
From: Krzysztof Kozlowski @ 2022-05-18 7:12 UTC (permalink / raw)
To: Wan Jiabing, Vinod Koul, Orson Zhai, Baolin Wang, Chunyan Zhang,
Linus Walleij, dmaengine, linux-kernel, linux-arm-kernel
On 16/05/2022 10:41, Wan Jiabing wrote:
> clk_put() already uses !clk and IS_ERR(clk) to check ERROR or NULL.
> Remove unneeded ERROR or NULL check for edmac->clk.
>
> Signed-off-by: Wan Jiabing <wanjiabing@vivo.com>
> ---
> drivers/dma/ep93xx_dma.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/dma/ep93xx_dma.c b/drivers/dma/ep93xx_dma.c
> index 971ff5f9ae84..60dc7b3f3d0d 100644
> --- a/drivers/dma/ep93xx_dma.c
> +++ b/drivers/dma/ep93xx_dma.c
> @@ -1398,8 +1398,7 @@ static int __init ep93xx_dma_probe(struct platform_device *pdev)
> if (unlikely(ret)) {
> for (i = 0; i < edma->num_channels; i++) {
> struct ep93xx_dma_chan *edmac = &edma->channels[i];
> - if (!IS_ERR_OR_NULL(edmac->clk))
> - clk_put(edmac->clk);
> + clk_put(edmac->clk);
clk_put() which calls __clk_put() seems to print warning on IS_ERR, so
this does not look equivalent code.
Best regards,
Krzysztof
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH 2/4] dmaengine: sprd-dma: Remove unneeded ERROR check before clk_disable_unprepare
2022-05-16 8:41 ` Wan Jiabing
@ 2022-05-18 7:12 ` Krzysztof Kozlowski
-1 siblings, 0 replies; 24+ messages in thread
From: Krzysztof Kozlowski @ 2022-05-18 7:12 UTC (permalink / raw)
To: Wan Jiabing, Vinod Koul, Orson Zhai, Baolin Wang, Chunyan Zhang,
Linus Walleij, dmaengine, linux-kernel, linux-arm-kernel
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
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH 2/4] dmaengine: sprd-dma: Remove unneeded ERROR check before clk_disable_unprepare
@ 2022-05-18 7:12 ` Krzysztof Kozlowski
0 siblings, 0 replies; 24+ messages in thread
From: Krzysztof Kozlowski @ 2022-05-18 7:12 UTC (permalink / raw)
To: Wan Jiabing, Vinod Koul, Orson Zhai, Baolin Wang, Chunyan Zhang,
Linus Walleij, dmaengine, linux-kernel, linux-arm-kernel
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
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH 3/4] dmaengine: ste_dma40: Remove unneeded ERROR and NULL check in ste_dma40
2022-05-16 8:41 ` Wan Jiabing
@ 2022-05-18 7:15 ` Krzysztof Kozlowski
-1 siblings, 0 replies; 24+ messages in thread
From: Krzysztof Kozlowski @ 2022-05-18 7:15 UTC (permalink / raw)
To: Wan Jiabing, Vinod Koul, Orson Zhai, Baolin Wang, Chunyan Zhang,
Linus Walleij, dmaengine, linux-kernel, linux-arm-kernel
On 16/05/2022 10:41, Wan Jiabing wrote:
> 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;
This should be rather return PTR_ERR. No need to jump to labels which
are not relevant (even if harmless) for this case. It's a confusing code.
> }
>
> 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;
> }
>
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH 3/4] dmaengine: ste_dma40: Remove unneeded ERROR and NULL check in ste_dma40
@ 2022-05-18 7:15 ` Krzysztof Kozlowski
0 siblings, 0 replies; 24+ messages in thread
From: Krzysztof Kozlowski @ 2022-05-18 7:15 UTC (permalink / raw)
To: Wan Jiabing, Vinod Koul, Orson Zhai, Baolin Wang, Chunyan Zhang,
Linus Walleij, dmaengine, linux-kernel, linux-arm-kernel
On 16/05/2022 10:41, Wan Jiabing wrote:
> 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;
This should be rather return PTR_ERR. No need to jump to labels which
are not relevant (even if harmless) for this case. It's a confusing code.
> }
>
> 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;
> }
>
Best regards,
Krzysztof
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH 3/4] dmaengine: ste_dma40: Remove unneeded ERROR and NULL check in ste_dma40
2022-05-18 7:15 ` Krzysztof Kozlowski
@ 2022-05-19 6:34 ` Jiabing Wan
-1 siblings, 0 replies; 24+ messages in thread
From: Jiabing Wan @ 2022-05-19 6:34 UTC (permalink / raw)
To: Krzysztof Kozlowski, Vinod Koul, Orson Zhai, Baolin Wang,
Chunyan Zhang, Linus Walleij, dmaengine, linux-kernel,
linux-arm-kernel
On 2022/5/18 15:15, Krzysztof Kozlowski wrote:
> On 16/05/2022 10:41, Wan Jiabing wrote:
>> 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;
> This should be rather return PTR_ERR. No need to jump to labels which
> are not relevant (even if harmless) for this case. It's a confusing code.
OK, I'll fix it.
>> }
>>
>> 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);
So this IS_ERR(clk) is also better than WARN_ON_ONCE(IS_ERR(clk)) in
clk_put().
IS_ERR(clk) before clk_put(clk) is needed for avoiding the unexpected warning.
>> + clk_disable_unprepare(clk);
>> + clk_put(clk);
>> +
>> return NULL;
>> }
>>
Thanks,
Wan Jiabing
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH 3/4] dmaengine: ste_dma40: Remove unneeded ERROR and NULL check in ste_dma40
@ 2022-05-19 6:34 ` Jiabing Wan
0 siblings, 0 replies; 24+ messages in thread
From: Jiabing Wan @ 2022-05-19 6:34 UTC (permalink / raw)
To: Krzysztof Kozlowski, Vinod Koul, Orson Zhai, Baolin Wang,
Chunyan Zhang, Linus Walleij, dmaengine, linux-kernel,
linux-arm-kernel
On 2022/5/18 15:15, Krzysztof Kozlowski wrote:
> On 16/05/2022 10:41, Wan Jiabing wrote:
>> 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;
> This should be rather return PTR_ERR. No need to jump to labels which
> are not relevant (even if harmless) for this case. It's a confusing code.
OK, I'll fix it.
>> }
>>
>> 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);
So this IS_ERR(clk) is also better than WARN_ON_ONCE(IS_ERR(clk)) in
clk_put().
IS_ERR(clk) before clk_put(clk) is needed for avoiding the unexpected warning.
>> + clk_disable_unprepare(clk);
>> + clk_put(clk);
>> +
>> return NULL;
>> }
>>
Thanks,
Wan Jiabing
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 24+ messages in thread
end of thread, other threads:[~2022-05-19 6:36 UTC | newest]
Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [PATCH 3/4] dmaengine: ste_dma40: Remove unneeded ERROR and NULL check in ste_dma40 Wan Jiabing
2022-05-16 8:41 ` 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
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.