linux-omap.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mfd: Fix usbhs_enable error handling
@ 2011-04-21 14:22 Keshava Munegowda
       [not found] ` <1303395763-8702-1-git-send-email-keshava_mgowda-l0cyMroinI0@public.gmane.org>
  0 siblings, 1 reply; 21+ messages in thread
From: Keshava Munegowda @ 2011-04-21 14:22 UTC (permalink / raw)
  To: linux-usb-u79uwXL29TY76Z2rM5mHXA,
	linux-omap-u79uwXL29TY76Z2rM5mHXA
  Cc: Keshava Munegowda, balbi-l0cyMroinI0, gadiyar-l0cyMroinI0,
	p-basak2-l0cyMroinI0, axel.lin-Re5JQEeQqe8AvxtiuMwx3w,
	johnstul-r/Jw6+rmf7HQT0dZR+AlfA, mpfj-list-kZtEnBLzDKq1Qrn1Bg8BZw

From: Axel Lin <axel.lin-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

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-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
 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 53450f4..b3bb3ac 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);

^ permalink raw reply related	[flat|nested] 21+ messages in thread
[parent not found: <1301393275.2253.7.camel@phoenix>]

end of thread, other threads:[~2011-05-02 12:29 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-21 14:22 [PATCH] mfd: Fix usbhs_enable error handling Keshava Munegowda
     [not found] ` <1303395763-8702-1-git-send-email-keshava_mgowda-l0cyMroinI0@public.gmane.org>
2011-04-21 14:22   ` [PATCH] omap:usb: fixing ehci phy gpio values for omap3 Keshava Munegowda
     [not found]     ` <1303395763-8702-2-git-send-email-keshava_mgowda-l0cyMroinI0@public.gmane.org>
2011-04-21 14:22       ` [PATCH] omap:usb: add regulator support for EHCI Keshava Munegowda
     [not found]         ` <1303395763-8702-3-git-send-email-keshava_mgowda-l0cyMroinI0@public.gmane.org>
2011-05-02  9:38           ` Felipe Balbi
2011-04-26 13:40       ` [PATCH] omap:usb: fixing ehci phy gpio values for omap3 Menon, Nishanth
     [not found]         ` <BANLkTi=fQCRAST1DvJEAnznNnySCv55Yag-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-04-27  5:52           ` Munegowda, Keshava
     [not found]             ` <BANLkTi=apB0cZpgzFjHKuArrxkQX5W7deQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-04-27  7:58               ` Felipe Balbi
     [not found]                 ` <20110427075843.GS13227-UiBtZHVXSwEVvW8u9ZQWYwjfymiNCTlR@public.gmane.org>
2011-04-27  8:26                   ` Munegowda, Keshava
2011-05-02  9:38     ` Felipe Balbi
     [not found]       ` <20110502093815.GQ2529-UiBtZHVXSwEVvW8u9ZQWYwjfymiNCTlR@public.gmane.org>
2011-05-02 11:31         ` Munegowda, Keshava
     [not found]           ` <BANLkTi=kH02P9GFo6wmPpRGr=L582DEp0A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-05-02 11:54             ` Felipe Balbi
2011-05-02 12:23               ` Munegowda, Keshava
2011-04-26  8:58   ` [PATCH] mfd: Fix usbhs_enable error handling 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
     [not found] <1301393275.2253.7.camel@phoenix>
2011-03-29 10:35 ` Keshava Munegowda
2011-03-29 11:06   ` Felipe Balbi

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).