Re: [Suggestion] drivers/usb/core: for u16, use stack allocation instead of kmalloc

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Chen Gang wrote:
>   it is better to let "u16 status" instead of "u16 *status = kmalloc...".
..
>  940 int usb_get_status(struct usb_device *dev, int type, int target, void *data)
>  941 {
>  942         int ret;
>  943         u16 *status = kmalloc(sizeof(*status), GFP_KERNEL);
>  944 
>  945         if (!status)
>  946                 return -ENOMEM;
>  947 
>  948         ret = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0),
>  949                 USB_REQ_GET_STATUS, USB_DIR_IN | type, 0, target, status,
>  950                 sizeof(*status), USB_CTRL_GET_TIMEOUT);
>  951 
>  952         *(u16 *)data = *status;
>  953         kfree(status);
>  954         return ret;
>  955 }
>  956 EXPORT_SYMBOL_GPL(usb_get_status);

Maybe you can send a patch with a proposed improvement?


Best regards

//Peter
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux