linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] staging: unisys: use common return path
@ 2015-12-01 10:52 Sudip Mukherjee
  2016-02-07 22:04 ` Greg Kroah-Hartman
  0 siblings, 1 reply; 4+ messages in thread
From: Sudip Mukherjee @ 2015-12-01 10:52 UTC (permalink / raw)
  To: Benjamin Romer, David Kershner, Greg Kroah-Hartman
  Cc: linux-kernel, sparmaintainer, devel, Dan Carpenter,
	Sudip Mukherjee

The success path and the error path both are first doing
spin_unlock_irqrestore() before returning. Use that in the common path
and return the success/error value.

Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
---

v2: changed label name

It is dependent on the patch series sent by Benjamin (Nov 30th).

 drivers/staging/unisys/visornic/visornic_main.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/unisys/visornic/visornic_main.c b/drivers/staging/unisys/visornic/visornic_main.c
index 77fd1ef..342c0bf 100644
--- a/drivers/staging/unisys/visornic/visornic_main.c
+++ b/drivers/staging/unisys/visornic/visornic_main.c
@@ -357,15 +357,16 @@ visornic_serverdown(struct visornic_devdata *devdata,
 		    visorbus_state_complete_func complete_func)
 {
 	unsigned long flags;
+	int retval = 0;
 
 	spin_lock_irqsave(&devdata->priv_lock, flags);
 	if (!devdata->server_down && !devdata->server_change_state) {
 		if (devdata->going_away) {
-			spin_unlock_irqrestore(&devdata->priv_lock, flags);
 			dev_dbg(&devdata->dev->device,
 				"%s aborting because device removal pending\n",
 				__func__);
-			return -ENODEV;
+			retval = -ENODEV;
+			goto error;
 		}
 		devdata->server_change_state = true;
 		devdata->server_down_complete_func = complete_func;
@@ -374,11 +375,12 @@ visornic_serverdown(struct visornic_devdata *devdata,
 	} else if (devdata->server_change_state) {
 		dev_dbg(&devdata->dev->device, "%s changing state\n",
 			__func__);
-		spin_unlock_irqrestore(&devdata->priv_lock, flags);
-		return -EINVAL;
+		retval = -EINVAL;
 	}
+
+unlock:
 	spin_unlock_irqrestore(&devdata->priv_lock, flags);
-	return 0;
+	return retval;
 }
 
 /**
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] staging: unisys: use common return path
  2015-12-01 10:52 [PATCH v2] staging: unisys: use common return path Sudip Mukherjee
@ 2016-02-07 22:04 ` Greg Kroah-Hartman
  2016-02-08 17:16   ` Sudip Mukherjee
  0 siblings, 1 reply; 4+ messages in thread
From: Greg Kroah-Hartman @ 2016-02-07 22:04 UTC (permalink / raw)
  To: Sudip Mukherjee
  Cc: Benjamin Romer, David Kershner, devel, sparmaintainer,
	linux-kernel, Dan Carpenter

On Tue, Dec 01, 2015 at 04:22:33PM +0530, Sudip Mukherjee wrote:
> The success path and the error path both are first doing
> spin_unlock_irqrestore() before returning. Use that in the common path
> and return the success/error value.
> 
> Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
> ---
> 
> v2: changed label name
> 
> It is dependent on the patch series sent by Benjamin (Nov 30th).

Which didn't get applied, so can you resend this after that does get
accepted?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] staging: unisys: use common return path
  2016-02-07 22:04 ` Greg Kroah-Hartman
@ 2016-02-08 17:16   ` Sudip Mukherjee
  2016-02-10  5:12     ` Sudip Mukherjee
  0 siblings, 1 reply; 4+ messages in thread
From: Sudip Mukherjee @ 2016-02-08 17:16 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Benjamin Romer, David Kershner, devel, sparmaintainer,
	linux-kernel, Dan Carpenter

On Sun, Feb 07, 2016 at 02:04:21PM -0800, Greg Kroah-Hartman wrote:
> On Tue, Dec 01, 2015 at 04:22:33PM +0530, Sudip Mukherjee wrote:
> > The success path and the error path both are first doing
> > spin_unlock_irqrestore() before returning. Use that in the common path
> > and return the success/error value.
> > 
> > Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
> > ---
> > 
> > v2: changed label name
> > 
> > It is dependent on the patch series sent by Benjamin (Nov 30th).
> 
> Which didn't get applied, so can you resend this after that does get
> accepted?

oops, i dont think i have the patch anymore. But looking at the commit
message, i think i just sent the same suggestion to Benjamin for his
[PATCH v3 13/14] staging: unisys: fix else statement in visornic_main.c

If he is not changing then I will create the patch and send you.

regards
sudip

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] staging: unisys: use common return path
  2016-02-08 17:16   ` Sudip Mukherjee
@ 2016-02-10  5:12     ` Sudip Mukherjee
  0 siblings, 0 replies; 4+ messages in thread
From: Sudip Mukherjee @ 2016-02-10  5:12 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Benjamin Romer, David Kershner, devel, sparmaintainer,
	linux-kernel, Dan Carpenter

On Mon, Feb 08, 2016 at 10:46:57PM +0530, Sudip Mukherjee wrote:
> On Sun, Feb 07, 2016 at 02:04:21PM -0800, Greg Kroah-Hartman wrote:
> > On Tue, Dec 01, 2015 at 04:22:33PM +0530, Sudip Mukherjee wrote:
> > > The success path and the error path both are first doing
> > > spin_unlock_irqrestore() before returning. Use that in the common path
> > > and return the success/error value.
> > > 
> > > Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
> > > ---
> > > 
> > > v2: changed label name
> > > 
> > > It is dependent on the patch series sent by Benjamin (Nov 30th).
> > 
> > Which didn't get applied, so can you resend this after that does get
> > accepted?
> 
> oops, i dont think i have the patch anymore. But looking at the commit
> message, i think i just sent the same suggestion to Benjamin for his
> [PATCH v3 13/14] staging: unisys: fix else statement in visornic_main.c
> 
> If he is not changing then I will create the patch and send you.

Hi Greg,
I will not be resending this patch as Ben is against to using goto.

regards
sudip

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-02-10  5:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-01 10:52 [PATCH v2] staging: unisys: use common return path Sudip Mukherjee
2016-02-07 22:04 ` Greg Kroah-Hartman
2016-02-08 17:16   ` Sudip Mukherjee
2016-02-10  5:12     ` Sudip Mukherjee

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