Re: [PATCH] staging: typec: Fix sparse warnings about incorrect types

From: Guenter Roeck
Date: Wed May 10 2017 - 15:18:07 EST


On Wed, May 10, 2017 at 10:15 AM, Guru Das S <gurooodas@xxxxxxxxx> wrote:
> On 10 May 2017 at 08:23, Guenter Roeck <groeck@xxxxxxxxxx> wrote:
>
>> Please the patch into two parts, one per file; the required changes
>> for endianness support in tcpci.c are much more complex.
>
> I will send out a patch for the two simple fixes - the use of
> pd_header_cnt_le().
>
>> Excellent catch, but the fix is wrong. We don't want to change the
>> endianness here, since the data is sent to the chip. This will require
>> a (much) more comprehensive fix - header should probably be le16, the
>> second parameter to tcpci_write16() needs to be le16, plus everything
>> that comes with it (currently the code is just not endianness clean).
>> tcpci_read16() is also incorrect and has the same problem (it is
>> really a bad idea to read 16 bit into an unsigned int pointer).
>>
>> Let me know if you want to try to fix this; otherwise I'll do it.
>
> Sure, I'd like to give this a try. I will take a closer look at the
> code and get back to you with questions.

Thanks!
Guenter