/* Returns the number of bytes received on success, or else the status code returned by the underlying usb_control_msg() call.  */
int usb_get_status(struct usb_device *dev, int type, int target, void *data)
/* Returns the number of bytes received on success, or else the status code returned by the underlying usb_control_msg() call.  */
int usb_get_status(struct usb_device *dev, int type, int target, void *data)
{
	int ret;
	u16 *status = kmalloc(sizeof(*status), GFP_KERNEL);
	if (!status)
		return -ENOMEM;
	ret = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0),
		USB_REQ_GET_STATUS, USB_DIR_IN | type, 0, target, status,
		sizeof(*status), USB_CTRL_GET_TIMEOUT);
	*(u16 *)data = *status;
	kfree(status);
	return ret;
}