summaryrefslogtreecommitdiffstats
path: root/drivers/staging/usbip/stub_rx.c
diff options
context:
space:
mode:
authorMárton Németh2011-05-24 23:19:18 +0200
committerGreg Kroah-Hartman2011-06-07 22:53:24 +0200
commit9ba422b346c9654ec78ee0a5b7c5db6e5d4c48dd (patch)
treee0024ea28aa91174eac39fe1e0334affbb01396c /drivers/staging/usbip/stub_rx.c
parentstaging: usbip: vhci_hcd.c: rename init and exit functions (diff)
downloadkernel-qcow2-linux-9ba422b346c9654ec78ee0a5b7c5db6e5d4c48dd.tar.gz
kernel-qcow2-linux-9ba422b346c9654ec78ee0a5b7c5db6e5d4c48dd.tar.xz
kernel-qcow2-linux-9ba422b346c9654ec78ee0a5b7c5db6e5d4c48dd.zip
usbip: simplify lock handling in valid_request()
The function calls spin_lock() and spin_unlock() should be in pair. This patch makes this pairing more clear for the reader of the code. Signed-off-by: Márton Németh <nm127@freemail.hu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging/usbip/stub_rx.c')
-rw-r--r--drivers/staging/usbip/stub_rx.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/staging/usbip/stub_rx.c b/drivers/staging/usbip/stub_rx.c
index a5c1fa1f0430..e2cfedb6cc7a 100644
--- a/drivers/staging/usbip/stub_rx.c
+++ b/drivers/staging/usbip/stub_rx.c
@@ -304,18 +304,18 @@ static int stub_recv_cmd_unlink(struct stub_device *sdev,
static int valid_request(struct stub_device *sdev, struct usbip_header *pdu)
{
struct usbip_device *ud = &sdev->ud;
+ int valid = 0;
if (pdu->base.devid == sdev->devid) {
spin_lock(&ud->lock);
if (ud->status == SDEV_ST_USED) {
/* A request is valid. */
- spin_unlock(&ud->lock);
- return 1;
+ valid = 1;
}
spin_unlock(&ud->lock);
}
- return 0;
+ return valid;
}
static struct stub_priv *stub_priv_alloc(struct stub_device *sdev,