From: Matthias Brugger <matthias.bgg@gmail.com>
To: Arvind Yadav <arvind.yadav.cs@gmail.com>, gregkh@linuxfoundation.org
Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] usb: mtu3: Handle return value of clk_prepare_enable
Date: Sat, 10 Jun 2017 12:36:38 +0200 [thread overview]
Message-ID: <3fc5d464-9772-7579-39ab-039e690f6cb9@gmail.com> (raw)
In-Reply-To: <64498035baed409a32987e76838d19ccefe73c61.1497005619.git.arvind.yadav.cs@gmail.com>
On 09/06/17 14:03, 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>
> ---
> drivers/usb/mtu3/mtu3_plat.c | 23 ++++++++++++++++++++---
> 1 file changed, 20 insertions(+), 3 deletions(-)
>
Reviewed-by: Matthias Brugger <matthias.bgg@gmail.com>
> diff --git a/drivers/usb/mtu3/mtu3_plat.c b/drivers/usb/mtu3/mtu3_plat.c
> index 42550c7..0d3ebb3 100644
> --- a/drivers/usb/mtu3/mtu3_plat.c
> +++ b/drivers/usb/mtu3/mtu3_plat.c
> @@ -458,6 +458,7 @@ static int __maybe_unused mtu3_resume(struct device *dev)
> {
> struct platform_device *pdev = to_platform_device(dev);
> struct ssusb_mtk *ssusb = platform_get_drvdata(pdev);
> + int ret;
>
> dev_dbg(dev, "%s\n", __func__);
>
> @@ -465,12 +466,28 @@ static int __maybe_unused mtu3_resume(struct device *dev)
> return 0;
>
> ssusb_wakeup_disable(ssusb);
> - clk_prepare_enable(ssusb->sys_clk);
> - clk_prepare_enable(ssusb->ref_clk);
> - ssusb_phy_power_on(ssusb);
> + ret = clk_prepare_enable(ssusb->sys_clk);
> + if (ret)
> + goto err_sys_clk;
> +
> + ret = clk_prepare_enable(ssusb->ref_clk);
> + if (ret)
> + goto err_ref_clk;
> +
> + ret = ssusb_phy_power_on(ssusb);
> + if (ret)
> + goto err_power_on;
> +
> ssusb_host_enable(ssusb);
>
> return 0;
> +
> +err_power_on:
> + clk_disable_unprepare(ssusb->ref_clk);
> +err_ref_clk:
> + clk_disable_unprepare(ssusb->sys_clk);
> +err_sys_clk:
> + return ret;
> }
>
> static const struct dev_pm_ops mtu3_pm_ops = {
>
prev parent reply other threads:[~2017-06-10 10:36 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-09 12:03 Arvind Yadav
2017-06-10 10:36 ` Matthias Brugger [this message]
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=3fc5d464-9772-7579-39ab-039e690f6cb9@gmail.com \
--to=matthias.bgg@gmail.com \
--cc=arvind.yadav.cs@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
/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®