Re: [PATCH] staging: r8712u: use __le32 type for little-endian data

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

 



Thank you all for taking the time to look at this. I'm sorry for
filling your inboxes with my mistakes - as you probably guessed, I'm
new to kernel development, so I really appreciate the feedback.

Perry

On Fri, Feb 10, 2017 at 1:55 PM, Larry Finger <Larry.Finger@xxxxxxxxxxxx> wrote:
> On 02/10/2017 12:23 PM, Perry Hooker wrote:
>>
>> This patch fixes the following sparse warning:
>> drivers/staging/rtl8712/usb_ops_linux.c:212:33: warning: cast to
>> restricted __le32
>>
>> Signed-off-by: Perry Hooker <perry.hooker@xxxxxxxxx>
>> ---
>>  drivers/staging/rtl8712/usb_ops_linux.c | 5 +++--
>>  1 file changed, 3 insertions(+), 2 deletions(-)
>
>
> Are you using the staging branch of Greg's tree? If so, you should be using
> staging-next. The exact patch that you submitted has already been applied as
> commit 6839bc81478f entitled "staging: rtl8712: changed uint to __le32" and
> authored by Jannik Becher <becher.jannik@xxxxxxxxx>. The patch was applied
> on Tue Dec 20.
>
> Sorry that I did not remember about that earlier patch with the first reply;
> however, you did get the fix right this time. Congratulations as these
> endian issues can be difficult.
>
> In a quick look at the code, I see that there are a number of endian
> problems in the headers for the 802.11 packets, and in the macros that read
> and write the TX and RX descriptors. It is surprising that the driver
> actually works on big-endian hardware. I do not know how much experience you
> have, but the macros are tricky. I will try to get them cleaned up.
>
> Larry
>
>
>     staging: rtl8712: changed uint to __le32
>
>
>>
>> diff --git a/drivers/staging/rtl8712/usb_ops_linux.c
>> b/drivers/staging/rtl8712/usb_ops_linux.c
>> index fc6bb0b..df7c1aa 100644
>> --- a/drivers/staging/rtl8712/usb_ops_linux.c
>> +++ b/drivers/staging/rtl8712/usb_ops_linux.c
>> @@ -192,7 +192,8 @@ void r8712_usb_write_mem(struct intf_hdl *pintfhdl,
>> u32 addr, u32 cnt, u8 *wmem)
>>
>>  static void r8712_usb_read_port_complete(struct urb *purb)
>>  {
>> -       uint isevt, *pbuf;
>> +       __le32 *pbuf;
>> +       uint isevt;
>>         struct recv_buf *precvbuf = (struct recv_buf *)purb->context;
>>         struct _adapter *padapter = (struct _adapter *)precvbuf->adapter;
>>         struct recv_priv *precvpriv = &padapter->recvpriv;
>> @@ -208,7 +209,7 @@ static void r8712_usb_read_port_complete(struct urb
>> *purb)
>>                         _pkt *pskb = precvbuf->pskb;
>>
>>                         precvbuf->transfer_len = purb->actual_length;
>> -                       pbuf = (uint *)precvbuf->pbuf;
>> +                       pbuf = (__le32 *)precvbuf->pbuf;
>>                         isevt = le32_to_cpu(*(pbuf + 1)) & 0x1ff;
>>                         if ((isevt & 0x1ff) == 0x1ff) {
>>                                 r8712_rxcmd_event_hdl(padapter, pbuf);
>>
>
_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel



[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux