On 28.10.20 20:00, Marc Kleine-Budde wrote:
On 10/28/20 7:55 PM, Oliver Hartkopp wrote:
On 28.10.20 19:34, Marc Kleine-Budde wrote:
On 10/28/20 7:09 PM, Oliver Hartkopp wrote:
The macro was always used together with can_dlc2len() which sanitizes the
given dlc value on its own.
Signed-off-by: Oliver Hartkopp <socketcan@xxxxxxxxxxxx>
---
drivers/net/can/flexcan.c | 2 +-
drivers/net/can/peak_canfd/peak_canfd.c | 2 +-
drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c | 2 +-
drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c | 2 +-
drivers/net/can/usb/peak_usb/pcan_usb_fd.c | 2 +-
include/linux/can/dev.h | 1 -
include/linux/can/dev/peak_canfd.h | 2 +-
7 files changed, 6 insertions(+), 7 deletions(-)
diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c
index b30e3171cbd0..137f46705814 100644
--- a/drivers/net/can/flexcan.c
+++ b/drivers/net/can/flexcan.c
@@ -996,11 +996,11 @@ static struct sk_buff *flexcan_mailbox_read(struct can_rx_offload *offload,
cfd->can_id = ((reg_id >> 0) & CAN_EFF_MASK) | CAN_EFF_FLAG;
else
cfd->can_id = (reg_id >> 18) & CAN_SFF_MASK;
if (reg_ctrl & FLEXCAN_MB_CNT_EDL) {
- cfd->len = can_dlc2len(get_canfd_dlc((reg_ctrl >> 16) & 0xf));
+ cfd->len = can_dlc2len((u8)((reg_ctrl >> 16) & 0xf));
Where does the u8 come from? The can_dlc2len() only takes an u8, so the cast is
not needed.
But reg_ctrl is u32. No need for a cast here?
No, not needed.
Ok, thanks. Still something to learn every day ;-)
Will send a v3 with a removed cast tomorrow.
Best,
Oliver