From: Keshava Munegowda <keshava_mgowda@ti.com>
To: Axel Lin <axel.lin@gmail.com>,
linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org,
linux-omap@vger.kernel.org
Cc: Samuel Ortiz <sameo@linux.intel.com>
Subject: RE: [PATCH] mfd: Fix usbhs_enable error handling
Date: Tue, 29 Mar 2011 16:05:40 +0530 [thread overview]
Message-ID: <50616adee81e0719b7b35884bfa194eb@mail.gmail.com> (raw)
In-Reply-To: <1301393275.2253.7.camel@phoenix>
> -----Original Message-----
> From: Axel Lin [mailto:axel.lin@gmail.com]
> Sent: Tuesday, March 29, 2011 3:38 PM
> To: linux-kernel@vger.kernel.org
> Cc: Keshava Munegowda; Samuel Ortiz
> Subject: [PATCH] mfd: Fix usbhs_enable error handling
>
> In the case of missing platform_data we do not hold a spin_lock,
> thus we should not call spin_unlock_irqrestore in the error path.
>
> Also simplify the error handling by separating the successful path
> from error path. I think this change improves readability.
>
> Signed-off-by: Axel Lin <axel.lin@gmail.com>
> ---
> drivers/mfd/omap-usb-host.c | 8 +++-----
> 1 files changed, 3 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/mfd/omap-usb-host.c b/drivers/mfd/omap-usb-host.c
> index cb01209..4157d76 100644
> --- a/drivers/mfd/omap-usb-host.c
> +++ b/drivers/mfd/omap-usb-host.c
> @@ -700,8 +700,7 @@ static int usbhs_enable(struct device *dev)
> dev_dbg(dev, "starting TI HSUSB Controller\n");
> if (!pdata) {
> dev_dbg(dev, "missing platform_data\n");
> - ret = -ENODEV;
> - goto end_enable;
> + return -ENODEV;
> }
>
> spin_lock_irqsave(&omap->lock, flags);
> @@ -915,7 +914,8 @@ static int usbhs_enable(struct device *dev)
>
> end_count:
> omap->count++;
> - goto end_enable;
> + spin_unlock_irqrestore(&omap->lock, flags);
> + return 0;
>
> err_tll:
> if (pdata->ehci_data->phy_reset) {
> @@ -931,8 +931,6 @@ err_tll:
> clk_disable(omap->usbhost_fs_fck);
> clk_disable(omap->usbhost_hs_fck);
> clk_disable(omap->usbhost_ick);
> -
> -end_enable:
> spin_unlock_irqrestore(&omap->lock, flags);
> return ret;
> }
> --
> 1.7.1
Thanks Axel!
Acked-by: Keshava Munegowda < keshava_mgowda@ti.com>
>
next parent reply other threads:[~2011-03-29 10:35 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1301393275.2253.7.camel@phoenix>
2011-03-29 10:35 ` Keshava Munegowda [this message]
2011-03-29 11:06 ` [PATCH] mfd: Fix usbhs_enable error handling Felipe Balbi
2011-04-21 14:22 Keshava Munegowda
[not found] ` <1303395763-8702-1-git-send-email-keshava_mgowda-l0cyMroinI0@public.gmane.org>
2011-04-26 8:58 ` Felipe Balbi
[not found] ` <20110426085846.GI13227-UiBtZHVXSwEVvW8u9ZQWYwjfymiNCTlR@public.gmane.org>
2011-04-26 9:02 ` Keshava Munegowda
2011-04-26 9:04 ` Felipe Balbi
[not found] ` <20110426090418.GJ13227-UiBtZHVXSwEVvW8u9ZQWYwjfymiNCTlR@public.gmane.org>
2011-04-26 15:09 ` Steve Calfee
[not found] ` <BANLkTi=NB5as-Kz8bSCvh3=KPQR1wwXUOQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-04-26 19:34 ` Felipe Balbi
[not found] ` <20110426193407.GR13227-UiBtZHVXSwEVvW8u9ZQWYwjfymiNCTlR@public.gmane.org>
2011-04-26 20:57 ` Steve Calfee
2011-05-02 9:37 ` Felipe Balbi
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=50616adee81e0719b7b35884bfa194eb@mail.gmail.com \
--to=keshava_mgowda@ti.com \
--cc=axel.lin@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=sameo@linux.intel.com \
/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;
as well as URLs for NNTP newsgroup(s).