From: Ludovic Desroches <ludovic.desroches@microchip.com>
To: Arvind Yadav <arvind.yadav.cs@gmail.com>
Cc: <ludovic.desroches@microchip.com>, <wsa@the-dreams.de>,
<linux-i2c@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] i2c: at91: Handle return value of clk_prepare_enable
Date: Wed, 31 May 2017 14:05:42 +0200 [thread overview]
Message-ID: <20170531120542.iscumzwkhbkd2wuv@rfolt0960.corp.atmel.com> (raw)
In-Reply-To: <74b05c5180872e368970562535bc305728da4be8.1496211597.git.arvind.yadav.cs@gmail.com>
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
next prev parent reply other threads:[~2017-05-31 12:06 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-31 6:57 Arvind Yadav
2017-05-31 12:05 ` Ludovic Desroches [this message]
2017-06-19 14:28 ` Wolfram Sang
2017-06-19 14:32 ` Wolfram Sang
2017-06-19 14:38 ` Wolfram Sang
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=20170531120542.iscumzwkhbkd2wuv@rfolt0960.corp.atmel.com \
--to=ludovic.desroches@microchip.com \
--cc=arvind.yadav.cs@gmail.com \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=wsa@the-dreams.de \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®