1
0
Fork 0
mirror of synced 2025-03-06 20:59:54 +01:00
linux/drivers/net/can/spi/mcp251xfd
Marc Kleine-Budde 1c0e78a287 can: mcp251xfd: mcp251xfd_register_get_dev_id(): fix endianness conversion
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. Further it is not naturally aligned in struct
mcp251xfd_map_buf_nocrc::data. However after the transfer the register
content is converted from big endian to CPU endianness not taking care
of being unaligned.

Fix the conversion by converting from little endian to CPU endianness
taking the unaligned source into account.

Side note: So far the register content is 0x0 on all mcp251xfd
compatible chips, and is only used for an informative printk.

Link: https://lore.kernel.org/all/20220627092859.809042-1-mkl@pengutronix.de
Fixes: 55e5b97f00 ("can: mcp25xxfd: add driver for Microchip MCP25xxFD SPI CAN")
Reviewed-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2022-07-04 12:51:43 +02:00
..
Kconfig can: mcp251xfd: add dev coredump support 2021-03-30 11:14:49 +02:00
Makefile can: mcp251xfd: ethtool: add support 2022-03-13 09:45:35 +01:00
mcp251xfd-chip-fifo.c can: mcp251xfd: introduce struct mcp251xfd_tx_ring::nr and ::fifo_nr and make use of it 2022-02-24 08:46:59 +01:00
mcp251xfd-core.c can: mcp251xfd: mcp251xfd_register_get_dev_id(): fix endianness conversion 2022-07-04 12:51:43 +02:00
mcp251xfd-crc16.c can: mcp251xfd: rename all remaining occurrence to mcp251xfd 2020-09-30 21:55:28 +02:00
mcp251xfd-dump.c can: mcp251xfd: introduce struct mcp251xfd_tx_ring::nr and ::fifo_nr and make use of it 2022-02-24 08:46:59 +01:00
mcp251xfd-dump.h can: mcp251xfd: add dev coredump support 2021-03-30 11:14:49 +02:00
mcp251xfd-ethtool.c can: mcp251xfd: add TX IRQ coalescing ethtool support 2022-03-13 09:45:36 +01:00
mcp251xfd-ram.c can: mcp251xfd: ram: coalescing support 2022-03-13 09:45:35 +01:00
mcp251xfd-ram.h can: mcp251xfd: ram: coalescing support 2022-03-13 09:45:35 +01:00
mcp251xfd-regmap.c can: mcp251xfd: mcp251xfd_regmap_crc_read(): update workaround broken CRC on TBC register 2022-07-04 12:46:45 +02:00
mcp251xfd-ring.c can: mcp251xfd: add TX IRQ coalescing ethtool support 2022-03-13 09:45:36 +01:00
mcp251xfd-rx.c can: rx-offload: rename can_rx_offload_queue_sorted() -> can_rx_offload_queue_timestamp() 2022-04-19 16:58:04 +02:00
mcp251xfd-tef.c can: mcp251xfd: add TX IRQ coalescing support 2022-03-13 09:45:36 +01:00
mcp251xfd-timestamp.c can: mcp251xfd: mark some instances of struct mcp251xfd_priv as const 2021-08-19 15:07:03 +02:00
mcp251xfd-tx.c can: mcp251xfd: move TX handling into separate file 2022-01-08 20:17:42 +01:00
mcp251xfd.h can: mcp251xfd: silence clang's -Wunaligned-access warning 2022-05-19 22:15:51 +02:00