Re: [PATCH v2 3/4] can: remove obsolete get_canfd_dlc() macro

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

 





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?

BR,
Oliver



[Index of Archives]     [Automotive Discussions]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]     [CAN Bus]

  Powered by Linux