Skip to content

Commit c207a10

Browse files
Shuah Khangregkh
authored andcommitted
usbip: usbip_host_common: Use new error codes to return request status
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 <shuahkh@osg.samsung.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent f6bcbf2 commit c207a10

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

‎tools/usb/usbip/libsrc/usbip_host_common.c‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,14 +234,17 @@ int usbip_export_device(struct usbip_exported_device *edev, int sockfd)
234234
switch (edev->status) {
235235
case SDEV_ST_ERROR:
236236
dbg("status SDEV_ST_ERROR");
237+
ret = ST_DEV_ERR;
237238
break;
238239
case SDEV_ST_USED:
239240
dbg("status SDEV_ST_USED");
241+
ret = ST_DEV_BUSY;
240242
break;
241243
default:
242244
dbg("status unknown: 0x%x", edev->status);
245+
ret = -1;
243246
}
244-
return -1;
247+
return ret;
245248
}
246249

247250
/* only the first interface is true */

0 commit comments

Comments
 (0)