linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
To: Benjamin Romer <benjamin.romer@unisys.com>,
	David Kershner <david.kershner@unisys.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-kernel@vger.kernel.org, sparmaintainer@unisys.com,
	devel@driverdev.osuosl.org,
	Dan Carpenter <dan.carpenter@oracle.com>,
	Sudip Mukherjee <sudipm.mukherjee@gmail.com>
Subject: [PATCH v2] staging: unisys: use common return path
Date: Tue,  1 Dec 2015 16:22:33 +0530	[thread overview]
Message-ID: <1448967153-14537-1-git-send-email-sudipm.mukherjee@gmail.com> (raw)

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


             reply	other threads:[~2015-12-01 10:52 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-01 10:52 Sudip Mukherjee [this message]
2016-02-07 22:04 ` [PATCH v2] staging: unisys: use common return path Greg Kroah-Hartman
2016-02-08 17:16   ` Sudip Mukherjee
2016-02-10  5:12     ` Sudip Mukherjee

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=1448967153-14537-1-git-send-email-sudipm.mukherjee@gmail.com \
    --to=sudipm.mukherjee@gmail.com \
    --cc=benjamin.romer@unisys.com \
    --cc=dan.carpenter@oracle.com \
    --cc=david.kershner@unisys.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sparmaintainer@unisys.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).