[bug report] can: rockchip_canfd: add driver for Rockchip CAN-FD controller

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

 



Hello Marc Kleine-Budde,

Commit ff60bfbaf67f ("can: rockchip_canfd: add driver for Rockchip
CAN-FD controller") from Oct 11, 2023 (linux-next), leads to the
following Smatch static checker warning:

	drivers/net/can/rockchip/rockchip_canfd-core.c:497 rkcanfd_handle_error_int_reg_ec()
	warn: duplicate check 'reg_ec & ((((1))) << (21))' (previous on line 493)

drivers/net/can/rockchip/rockchip_canfd-core.c
    481                 else if (reg_ec & RKCANFD_REG_ERROR_CODE_RX_BUF_INT)
    482                         cf->data[3] = CAN_ERR_PROT_LOC_INTERM;
    483         } else {
    484                 cf->data[2] |= CAN_ERR_PROT_TX;
    485 
    486                 if (reg_ec & RKCANFD_REG_ERROR_CODE_TX_SOF_DLC)
    487                         cf->data[3] = CAN_ERR_PROT_LOC_SOF;
    488                 else if (reg_ec & RKCANFD_REG_ERROR_CODE_TX_DATA)
    489                         cf->data[3] = CAN_ERR_PROT_LOC_DATA;
    490                 /* RKCANFD_REG_ERROR_CODE_TX_STUFF_COUNT */
    491                 else if (reg_ec & RKCANFD_REG_ERROR_CODE_TX_CRC)
    492                         cf->data[3] = CAN_ERR_PROT_LOC_CRC_SEQ;
    493                 else if (reg_ec & RKCANFD_REG_ERROR_CODE_TX_ACK_EOF)
                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

    494                         cf->data[3] = CAN_ERR_PROT_LOC_ACK;
    495                 else if (reg_ec & RKCANFD_REG_ERROR_CODE_TX_ACK)
    496                         cf->data[3] = CAN_ERR_PROT_LOC_ACK;
--> 497                 else if (reg_ec & RKCANFD_REG_ERROR_CODE_TX_ACK_EOF)
                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
This is an else if statement so this is dead code.

    498                         cf->data[3] = CAN_ERR_PROT_LOC_ACK_DEL;
    499                 /* RKCANFD_REG_ERROR_CODE_TX_ERROR */
    500                 else if (reg_ec & RKCANFD_REG_ERROR_CODE_TX_OVERLOAD)
    501                         cf->data[2] |= CAN_ERR_PROT_OVERLOAD;
    502         }
    503 
    504         switch (reg_ec & RKCANFD_REG_ERROR_CODE_TYPE) {

regards,
dan carpenter




[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