[prev in list] [next in list] [prev in thread] [next in thread] 

List:       linux-can
Subject:    Re: [PATCH 6/6] can: peak_usb: add ethtool interface to user defined flashed device number
From:       Marc Kleine-Budde <mkl () pengutronix ! de>
Date:       2022-01-31 14:31:03
Message-ID: 20220131143103.nmp6fquyidsapw2l () pengutronix ! de
[Download RAW message or body]


On 31.01.2022 14:25:28, Stéphane Grosjean wrote:
> >> +     u32 devid;
> >>
> >> +             memcpy(data, (u8 *)&devid + eeprom->offset, eeprom->len);
> >
> > cast not needed.
> >
> 
> We need to cast the u32 * into a u8 * because eeprom->offset is a count of bytes, isn't it?

Doh! right.

What about endianness? I think it's better to use an array of bytes
everywhere.

Marc

-- 
Pengutronix e.K.                 | Marc Kleine-Budde           |
Embedded Linux                   | https://www.pengutronix.de  |
Vertretung West/Dortmund         | Phone: +49-231-2826-924     |
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917-5555 |

["signature.asc" (application/pgp-signature)]

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic