mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-27 20:55:09 +07:00
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>
This commit is contained in:
parent
0392bbb6f6
commit
9ba422b346
@ -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)
|
static int valid_request(struct stub_device *sdev, struct usbip_header *pdu)
|
||||||
{
|
{
|
||||||
struct usbip_device *ud = &sdev->ud;
|
struct usbip_device *ud = &sdev->ud;
|
||||||
|
int valid = 0;
|
||||||
|
|
||||||
if (pdu->base.devid == sdev->devid) {
|
if (pdu->base.devid == sdev->devid) {
|
||||||
spin_lock(&ud->lock);
|
spin_lock(&ud->lock);
|
||||||
if (ud->status == SDEV_ST_USED) {
|
if (ud->status == SDEV_ST_USED) {
|
||||||
/* A request is valid. */
|
/* A request is valid. */
|
||||||
spin_unlock(&ud->lock);
|
valid = 1;
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
spin_unlock(&ud->lock);
|
spin_unlock(&ud->lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return valid;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct stub_priv *stub_priv_alloc(struct stub_device *sdev,
|
static struct stub_priv *stub_priv_alloc(struct stub_device *sdev,
|
||||||
|
Loading…
Reference in New Issue
Block a user