Skip to content

Commit

Permalink
usbip: simplify lock handling in valid_request()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
nmarci1 authored and gregkh committed Jun 7, 2011
1 parent 0392bbb commit 9ba422b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions drivers/staging/usbip/stub_rx.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 9ba422b

Please sign in to comment.