* [PATCH] i2c: at91: Handle return value of clk_prepare_enable
@ 2017-05-31 6:57 Arvind Yadav
2017-05-31 12:05 ` Ludovic Desroches
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Arvind Yadav @ 2017-05-31 6:57 UTC (permalink / raw)
To: ludovic.desroches, wsa; +Cc: linux-i2c, linux-kernel
clk_prepare_enable() can fail here and we must check its return value.
Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
---
drivers/i2c/busses/i2c-at91.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/i2c/busses/i2c-at91.c b/drivers/i2c/busses/i2c-at91.c
index fabbb9e..2525cd9 100644
--- a/drivers/i2c/busses/i2c-at91.c
+++ b/drivers/i2c/busses/i2c-at91.c
@@ -1083,12 +1083,16 @@ static int at91_twi_probe(struct platform_device *pdev)
dev_err(dev->dev, "no clock defined\n");
return -ENODEV;
}
- clk_prepare_enable(dev->clk);
+ rc = clk_prepare_enable(dev->clk);
+ if (rc)
+ return rc;
if (dev->dev->of_node) {
rc = at91_twi_configure_dma(dev, phy_addr);
- if (rc == -EPROBE_DEFER)
+ if (rc == -EPROBE_DEFER) {
+ clk_disable_unprepare(dev->clk);
return rc;
+ }
}
if (!of_property_read_u32(pdev->dev.of_node, "atmel,fifo-size",
--
1.9.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] i2c: at91: Handle return value of clk_prepare_enable
2017-05-31 6:57 [PATCH] i2c: at91: Handle return value of clk_prepare_enable Arvind Yadav
@ 2017-05-31 12:05 ` Ludovic Desroches
2017-06-19 14:28 ` Wolfram Sang
2017-06-19 14:32 ` Wolfram Sang
2 siblings, 0 replies; 5+ messages in thread
From: Ludovic Desroches @ 2017-05-31 12:05 UTC (permalink / raw)
To: Arvind Yadav; +Cc: ludovic.desroches, wsa, linux-i2c, linux-kernel
On Wed, May 31, 2017 at 12:27:44PM +0530, Arvind Yadav wrote:
> clk_prepare_enable() can fail here and we must check its return value.
>
> Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
I would split this patch in:
- add missing clk_disable_unprepare()
- check clk_prepare_enable() return value
Since there are trivial fixes, maybe having them squashed is ok.
Acked-by: Ludovic Desroches <ludovic.desroches@microchip.com>
Thanks
> ---
> drivers/i2c/busses/i2c-at91.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-at91.c b/drivers/i2c/busses/i2c-at91.c
> index fabbb9e..2525cd9 100644
> --- a/drivers/i2c/busses/i2c-at91.c
> +++ b/drivers/i2c/busses/i2c-at91.c
> @@ -1083,12 +1083,16 @@ static int at91_twi_probe(struct platform_device *pdev)
> dev_err(dev->dev, "no clock defined\n");
> return -ENODEV;
> }
> - clk_prepare_enable(dev->clk);
> + rc = clk_prepare_enable(dev->clk);
> + if (rc)
> + return rc;
>
> if (dev->dev->of_node) {
> rc = at91_twi_configure_dma(dev, phy_addr);
> - if (rc == -EPROBE_DEFER)
> + if (rc == -EPROBE_DEFER) {
> + clk_disable_unprepare(dev->clk);
> return rc;
> + }
> }
>
> if (!of_property_read_u32(pdev->dev.of_node, "atmel,fifo-size",
> --
> 1.9.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] i2c: at91: Handle return value of clk_prepare_enable
2017-05-31 6:57 [PATCH] i2c: at91: Handle return value of clk_prepare_enable Arvind Yadav
2017-05-31 12:05 ` Ludovic Desroches
@ 2017-06-19 14:28 ` Wolfram Sang
2017-06-19 14:32 ` Wolfram Sang
2 siblings, 0 replies; 5+ messages in thread
From: Wolfram Sang @ 2017-06-19 14:28 UTC (permalink / raw)
To: Arvind Yadav; +Cc: ludovic.desroches, linux-i2c, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 302 bytes --]
On Wed, May 31, 2017 at 12:27:44PM +0530, Arvind Yadav wrote:
> clk_prepare_enable() can fail here and we must check its return value.
>
> Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
I update the commit message to mention the clk_unprepare addition.
Applied to for-next, thanks!
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] i2c: at91: Handle return value of clk_prepare_enable
2017-05-31 6:57 [PATCH] i2c: at91: Handle return value of clk_prepare_enable Arvind Yadav
2017-05-31 12:05 ` Ludovic Desroches
2017-06-19 14:28 ` Wolfram Sang
@ 2017-06-19 14:32 ` Wolfram Sang
2017-06-19 14:38 ` Wolfram Sang
2 siblings, 1 reply; 5+ messages in thread
From: Wolfram Sang @ 2017-06-19 14:32 UTC (permalink / raw)
To: Arvind Yadav; +Cc: ludovic.desroches, linux-i2c, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 311 bytes --]
On Wed, May 31, 2017 at 12:27:44PM +0530, Arvind Yadav wrote:
> clk_prepare_enable() can fail here and we must check its return value.
>
> Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Shortened the commit message a little (i'd think one example is enough)
and applied to for-next, thanks!
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] i2c: at91: Handle return value of clk_prepare_enable
2017-06-19 14:32 ` Wolfram Sang
@ 2017-06-19 14:38 ` Wolfram Sang
0 siblings, 0 replies; 5+ messages in thread
From: Wolfram Sang @ 2017-06-19 14:38 UTC (permalink / raw)
To: Arvind Yadav; +Cc: ludovic.desroches, linux-i2c, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 457 bytes --]
On Mon, Jun 19, 2017 at 04:32:32PM +0200, Wolfram Sang wrote:
> On Wed, May 31, 2017 at 12:27:44PM +0530, Arvind Yadav wrote:
> > clk_prepare_enable() can fail here and we must check its return value.
> >
> > Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
>
> Shortened the commit message a little (i'd think one example is enough)
> and applied to for-next, thanks!
Ooops, this was meant for your second patch! Sorry for the noise!
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2017-06-19 14:38 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-05-31 6:57 [PATCH] i2c: at91: Handle return value of clk_prepare_enable Arvind Yadav
2017-05-31 12:05 ` Ludovic Desroches
2017-06-19 14:28 ` Wolfram Sang
2017-06-19 14:32 ` Wolfram Sang
2017-06-19 14:38 ` Wolfram Sang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox