Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 363885
b: refs/heads/master
c: 31398f6
h: refs/heads/master
i:
  363883: b69156e
v: v3
  • Loading branch information
Kurt Kanzenbach authored and Greg Kroah-Hartman committed Apr 5, 2013
1 parent 15d977d commit 6becb51
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: ca9fb17e9377f820ac64e897452aaca0a079d766
refs/heads/master: 31398f6307d52fcb5aca6481fa4c84100aea97e3
22 changes: 12 additions & 10 deletions trunk/drivers/staging/usbip/stub_dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ static ssize_t store_sockfd(struct device *dev, struct device_attribute *attr,
struct stub_device *sdev = dev_get_drvdata(dev);
int sockfd = 0;
struct socket *socket;
ssize_t err = -EINVAL;

if (!sdev) {
dev_err(dev, "sdev is null\n");
Expand All @@ -101,15 +102,13 @@ static ssize_t store_sockfd(struct device *dev, struct device_attribute *attr,

if (sdev->ud.status != SDEV_ST_AVAILABLE) {
dev_err(dev, "not ready\n");
spin_unlock_irq(&sdev->ud.lock);
return -EINVAL;
goto err;
}

socket = sockfd_to_socket(sockfd);
if (!socket) {
spin_unlock_irq(&sdev->ud.lock);
return -EINVAL;
}
if (!socket)
goto err;

sdev->ud.tcp_socket = socket;

spin_unlock_irq(&sdev->ud.lock);
Expand All @@ -127,16 +126,19 @@ static ssize_t store_sockfd(struct device *dev, struct device_attribute *attr,
dev_info(dev, "stub down\n");

spin_lock_irq(&sdev->ud.lock);
if (sdev->ud.status != SDEV_ST_USED) {
spin_unlock_irq(&sdev->ud.lock);
return -EINVAL;
}
if (sdev->ud.status != SDEV_ST_USED)
goto err;

spin_unlock_irq(&sdev->ud.lock);

usbip_event_add(&sdev->ud, SDEV_EVENT_DOWN);
}

return count;

err:
spin_unlock_irq(&sdev->ud.lock);
return err;
}
static DEVICE_ATTR(usbip_sockfd, S_IWUSR, NULL, store_sockfd);

Expand Down

0 comments on commit 6becb51

Please sign in to comment.