Re: [PATCH v2] staging: typec: Fix endianness warning discovered by sparse

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

 



Guenter Roeck<linux@xxxxxxxxxxxx> / 2017-07-06T17:13-0700
> On 07/06/2017 03:54 PM, Thomas Gardner wrote:
> > The below warning is resolved by removing the cpu_to_le32() call. This
> > call was redundant; vdm_run_state_machine() ensures that SVDM responses
> > have the correct endianness before sending.
> > 
> > typec/tcpm.c:1019:49: warning: incorrect type in assignment (different base types)
> > typec/tcpm.c:1019:49:    expected unsigned int [unsigned] [usertype] <noident>
> > typec/tcpm.c:1019:49:    got restricted __le32 [usertype] <noident>
> > 
> > Signed-off-by: Thomas Gardner <tmg@xxxxxxxxxxxx>
> > ---
> >   drivers/staging/typec/tcpm.c | 3 +--
> >   1 file changed, 1 insertion(+), 2 deletions(-)
> > 
> > diff --git a/drivers/staging/typec/tcpm.c b/drivers/staging/typec/tcpm.c
> > index 20eb4ebcf8c3..0b596f56d18c 100644
> > --- a/drivers/staging/typec/tcpm.c
> > +++ b/drivers/staging/typec/tcpm.c
> > @@ -1015,8 +1015,7 @@ static int tcpm_pd_svdm(struct tcpm_port *port, const __le32 *payload, int cnt,
> >   			if (port->data_role == TYPEC_DEVICE &&
> >   			    port->nr_snk_vdo) {
> >   				for (i = 0; i <  port->nr_snk_vdo; i++)
> > -					response[i + 1]
> > -						= cpu_to_le32(port->snk_vdo[i]);
> > +					response[i + 1] = (port->snk_vdo[i]);
> 
> Unnecessary ( ).

Is there an adaptation of Muphry's Law for patches claiming to remove
redundancy?

> Guenter
> 
> >   				rlen = port->nr_snk_vdo + 1;
> >   			}
> >   			break;
> > 
> 


_______________________________________________
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