Skip to content

Commit

Permalink
usbip: usbip_host_common: Use new error codes to return request status
Browse files Browse the repository at this point in the history
Currently ST_OK and ST_NA are the only values used to communicate
status of a request from a client. Use new error codes to clearly
indicate what failed. For example, when client sends request to
import a device that isn't export-able, send ST_DEV_BUSY to the client.

Signed-off-by: Shuah Khan <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
Shuah Khan authored and gregkh committed Mar 9, 2018
1 parent f6bcbf2 commit c207a10
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion tools/usb/usbip/libsrc/usbip_host_common.c
Original file line number Diff line number Diff line change
@@ -234,14 +234,17 @@ int usbip_export_device(struct usbip_exported_device *edev, int sockfd)
switch (edev->status) {
case SDEV_ST_ERROR:
dbg("status SDEV_ST_ERROR");
ret = ST_DEV_ERR;
break;
case SDEV_ST_USED:
dbg("status SDEV_ST_USED");
ret = ST_DEV_BUSY;
break;
default:
dbg("status unknown: 0x%x", edev->status);
ret = -1;
}
return -1;
return ret;
}

/* only the first interface is true */

0 comments on commit c207a10

Please sign in to comment.