RE: [PATCH v2] usb: musb: gadget: Fix big-endian arch issue

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

 



Hi Andy,

Before my change: 

CHECK   drivers/usb/musb/musb_gadget_ep0.c
drivers/usb/musb/musb_gadget_ep0.c:85:26: warning: cast from restricted __le16
drivers/usb/musb/musb_gadget_ep0.c:220:58: warning: restricted __le16 degrades to integer
drivers/usb/musb/musb_gadget_ep0.c:227:48: warning: restricted __le16 degrades to integer
drivers/usb/musb/musb_gadget_ep0.c:237:52: warning: restricted __le16 degrades to integer
drivers/usb/musb/musb_gadget_ep0.c:251:52: warning: restricted __le16 degrades to integer
drivers/usb/musb/musb_gadget_ep0.c:310:56: warning: restricted __le16 degrades to integer
drivers/usb/musb/musb_gadget_ep0.c:313:60: warning: restricted __le16 degrades to integer
drivers/usb/musb/musb_gadget_ep0.c:303:52: warning: restricted __le16 degrades to integer
drivers/usb/musb/musb_gadget_ep0.c:303:52: warning: restricted __le16 degrades to integer
drivers/usb/musb/musb_gadget_ep0.c:303:52: warning: restricted __le16 degrades to integer
drivers/usb/musb/musb_gadget_ep0.c:303:52: warning: restricted __le16 degrades to integer
drivers/usb/musb/musb_gadget_ep0.c:303:52: warning: restricted __le16 degrades to integer
drivers/usb/musb/musb_gadget_ep0.c:303:52: warning: restricted __le16 degrades to integer
drivers/usb/musb/musb_gadget_ep0.c:402:52: warning: restricted __le16 degrades to integer
drivers/usb/musb/musb_gadget_ep0.c:415:52: warning: restricted __le16 degrades to integer
drivers/usb/musb/musb_gadget_ep0.c:540:22: warning: expression using sizeof(void)

After my change:

CHECK   drivers/usb/musb/musb_gadget_ep0.c
drivers/usb/musb/musb_gadget_ep0.c:539:22: warning: expression using sizeof(void)

PS: Thanks for hint about endian issues check!

Best regards,
Alexey Spirkov

-----Original Message-----
From: Andy Shevchenko <andy.shevchenko@xxxxxxxxx> 
Sent: Friday, August 3, 2018 12:17 PM
To: Alexey Spirkov <AlexeiS@xxxxxxxxxxxx>
Cc: Bin Liu <b-liu@xxxxxx>; Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>; linux-usb@xxxxxxxxxxxxxxx; andrew@xxxxxxxxxx
Subject: Re: [PATCH v2] usb: musb: gadget: Fix big-endian arch issue

On Fri, Aug 3, 2018 at 12:03 PM, Alexey Spirkov <AlexeiS@xxxxxxxxxxxx> wrote:
> Existing code is not applicable to big-endian machines ctrlrequest 
> fields received in USB endian - i.e. in little-endian and should be 
> converted to cpu endianness before usage.

> -               epnum = (u8) ctrlrequest->wIndex;
> +               epnum = (u8) le16_to_cpu(ctrlrequest->wIndex);

> +       u16 reqval = le16_to_cpu(ctrlrequest->wValue);
> +       u16 reqidx = le16_to_cpu(ctrlrequest->wIndex);

I'm wondering, if you run make with C=1 CF=-D__CHECK_ENDIAN__ before and after your change.


--
With Best Regards,
Andy Shevchenko
��.n��������+%������w��{.n�����{���)��jg��������ݢj����G�������j:+v���w�m������w�������h�����٥




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

  Powered by Linux