On Mon, Jun 20, 2022 at 04:49:54PM +0200, Marc Kleine-Budde wrote: > In mcp251xfd_register_get_dev_id() the device ID register is read with > handcrafted SPI transfers. As all registers, this register is in > little endian, too. However after the transfer the register content is > converted from big endian to CPU endianness. > > Fix the conversion by converting from little endian to CPU endianness. > > Side note: So far the register content is 0x0 on all mcp251xfd > compatible chips, and is only used for an informative printk. > > Fixes: 55e5b97f003e ("can: mcp25xxfd: add driver for Microchip MCP25xxFD SPI CAN") > Cc: Rasmus Villemoes <rasmus.villemoes@xxxxxxxxx> > Signed-off-by: Marc Kleine-Budde <mkl@xxxxxxxxxxxxxx> Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@xxxxxxxxxx> Thanks, Mani > --- > drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c b/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c > index 3160881e89d9..d7f406dbe2ce 100644 > --- a/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c > +++ b/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c > @@ -1787,7 +1787,7 @@ mcp251xfd_register_get_dev_id(const struct mcp251xfd_priv *priv, u32 *dev_id, > if (err) > goto out_kfree_buf_tx; > > - *dev_id = be32_to_cpup((__be32 *)buf_rx->data); > + *dev_id = le32_to_cpup((__le32 *)buf_rx->data); > *effective_speed_hz_slow = xfer[0].effective_speed_hz; > *effective_speed_hz_fast = xfer[1].effective_speed_hz; > > -- > 2.35.1 > > -- மணிவண்ணன் சதாசிவம்