can: c_can: precedence error in c_can_chip_config()
Subsystems (4)
PATCH 1/1 can: c_can: precedence error in c_can_chip_config()
(CAN_CTRLMODE_LISTENONLY & CAN_CTRLMODE_LOOPBACK) is (0x02 & 0x01) which is zero so the condition is never true. The intent here was to test that both flags were set.
---
This is a static checker fix. I'm not super familiar with the c_can code.
drivers/net/can/c_can/c_can.c +2 -2
@@ -594,8 +594,8 @@ static void c_can_chip_config(struct net_device *dev) priv->write_reg (priv,C_CAN_CTRL_REG ,CONTROL_ENABLE_AR ); -if (priv->can.ctrlmode & (CAN_CTRLMODE_LISTENONLY & -CAN_CTRLMODE_LOOPBACK )) { +if ((priv->can.ctrlmode &CAN_CTRLMODE_LISTENONLY ) && + (priv->can.ctrlmode &CAN_CTRLMODE_LOOPBACK )) {/* loopback + silent mode : useful for hot self-test */ priv->write_reg (priv,C_CAN_CTRL_REG ,CONTROL_EIE |CONTROL_SIE |CONTROL_IE |CONTROL_TEST );
Marc Kleine-Budde
maintainerQuoted 8 lines · Dan Carpenter
(
CAN_CTRLMODE_LISTENONLY&CAN_CTRLMODE_LOOPBACK) is (0x02&0x01) which is zero so the condition is never true. The intent here was to test that both flags were set.Signed-off-by Dan Carpenter <[email protected]>---
This is a static checker fix. I'm not super familiar with thec_cancode.
Good catch. Applied to can-next.
Marc
Signature · 4 lines
Pengutronix e.K. | Marc Kleine-Budde | Industrial Linux Solutions | Phone: +49-231-2826-924 | Vertretung West/Dortmund | Fax: +49-5121-206917-5555 | Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de |
Quoted 5 lines · Marc Kleine-Budde
Quoted 4 lines · Dan Carpenter
(
CAN_CTRLMODE_LISTENONLY&CAN_CTRLMODE_LOOPBACK) is (0x02&0x01) which is zero so the condition is never true. The intent here was to test that both flags were set.
Quoted 9 lines
Quoted 4 lines
Signed-off-by Dan Carpenter <[email protected]>---
This is a static checker fix. I'm not super familiar with thec_cancode.Good catch. Applied to can-next.
Marc
Shouldn't this fix go through the net-tree and stable instead of net-next?
Regards,
Oliver
Marc Kleine-Budde
maintainerQuoted 12 lines · Oliver Hartkopp
Quoted 10 lines · Marc Kleine-Budde
Quoted 8 lines · Dan Carpenter
(
CAN_CTRLMODE_LISTENONLY&CAN_CTRLMODE_LOOPBACK) is (0x02&0x01) which is zero so the condition is never true. The intent here was to test that both flags were set.Signed-off-by Dan Carpenter <[email protected]>---
This is a static checker fix. I'm not super familiar with thec_cancode.
Quoted 7 lines
Quoted 4 lines
Good catch. Applied to can-next.
Marc
Shouldn't this fix go through the net-tree and stable instead of net-next?
Indeed.
Marc
Signature · 4 lines
Pengutronix e.K. | Marc Kleine-Budde | Industrial Linux Solutions | Phone: +49-231-2826-924 | Vertretung West/Dortmund | Fax: +49-5121-206917-5555 | Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de |
Marc Kleine-Budde
maintainerQuoted 12 lines · Oliver Hartkopp
Quoted 10 lines · Marc Kleine-Budde
Quoted 8 lines · Dan Carpenter
(
CAN_CTRLMODE_LISTENONLY&CAN_CTRLMODE_LOOPBACK) is (0x02&0x01) which is zero so the condition is never true. The intent here was to test that both flags were set.Signed-off-by Dan Carpenter <[email protected]>---
This is a static checker fix. I'm not super familiar with thec_cancode.
Quoted 7 lines
Quoted 4 lines
Good catch. Applied to can-next.
Marc
Shouldn't this fix go through the net-tree and stable instead of net-next?
Can I add your Acked-by ... when adding to net?
Marc
Signature · 4 lines
Pengutronix e.K. | Marc Kleine-Budde | Industrial Linux Solutions | Phone: +49-231-2826-924 | Vertretung West/Dortmund | Fax: +49-5121-206917-5555 | Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de |
Quoted 15 lines · Marc Kleine-Budde
Quoted 14 lines · Oliver Hartkopp
Quoted 12 lines · Marc Kleine-Budde
Quoted 8 lines · Dan Carpenter
(
CAN_CTRLMODE_LISTENONLY&CAN_CTRLMODE_LOOPBACK) is (0x02&0x01) which is zero so the condition is never true. The intent here was to test that both flags were set.Signed-off-by Dan Carpenter <[email protected]>---
This is a static checker fix. I'm not super familiar with thec_cancode.Good catch. Applied to can-next.
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
Marc
Shouldn't this fix go through the net-tree and stable instead of net-next?
Can I add your Acked-by ... when adding to net?
Yes you can :-)
Oliver