Skip to contentSkip to conversation

can: Allwinner A10/A20 CAN Controller support - Kernel module

DISCUSSION Dan Carpenter 2 participants 2 messages Sep 23, 2015 CAN network drivers

lore
Share & tools
lore
#0 lore raw

Hello Gerhard Bertelsmann,

The patch 0738eff14d81: "can: Allwinner A10/A20 CAN Controller support - Kernel module" from Sep 16, 2015, leads to the following static checker warning:

	drivers/net/can/sun4i_can.c:604 sun4i_can_err()
	warn: mask and shift to zero

drivers/net/can/sun4i_can.c
596 if (isrc & SUN4I_INT_ARB_LOST) {

   597                  /* arbitration lost interrupt */
   598                  netdev_dbg(dev, "arbitration lost interrupt\n");
   599                  alc = readl(priv->base + SUN4I_REG_STA_ADDR);
   600                  priv->can.can_stats.arbitration_lost++;
   601                  stats->tx_errors++;
   602                  if (likely(skb)) {
   603                          cf->can_id |= CAN_ERR_LOSTARB;
   604                          cf->data[0] = (alc & 0x1f) >> 8;
                                              ^^^^^^^^^^^^^^^^^^

This is zero. No idea what was intended.

605 }
606 }

regards,
dan carpenter

#1 lore raw

Hi Dan,

Am 2015-09-23 09:19, schrieb Dan Carpenter:

Quoted 21 lines

Hello Gerhard Bertelsmann,

The patch 0738eff14d81: "can: Allwinner A10/A20 CAN Controller support - Kernel module" from Sep 16, 2015, leads to the following static checker warning:

	drivers/net/can/sun4i_can.c:604 sun4i_can_err()
	warn: mask and shift to zero

drivers/net/can/sun4i_can.c
596 if (isrc & SUN4I_INT_ARB_LOST) {
597 /* arbitration lost interrupt */
598 netdev_dbg(dev, "arbitration lost

interrupt\n");
   599                  alc = readl(priv->base + SUN4I_REG_STA_ADDR);
   600                  priv->can.can_stats.arbitration_lost++;
   601                  stats->tx_errors++;
   602                  if (likely(skb)) {
   603                          cf->can_id |= CAN_ERR_LOSTARB;
   604                          cf->data[0] = (alc & 0x1f) >> 8;
                                              ^^^^^^^^^^^^^^^^^^
Quoted 1 line

This is zero. No idea what was intended.

indeed, that's wrong - mask should be 0x1f00.
I will send an update. Thanks for your hint.

Quoted 6 lines
   605                  }
   606          }

regards,
dan carpenter

Regards,

Gerd