Skip to contentSkip to conversation

net: can: dev: remove unused code in can_restart

PATCH New Gustavo A. R. Silva 1 participant 1 message Oct 21, 2017

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: can: dev: remove unused code in can_restart

Value assigned to variable err is overwritten at line 562: err = priv->do_set_mode(dev, CAN_MODE_START); before it can be used.

Also, notice that this code has been there since 2014.

Addresses-Coverity-ID: 1227031

---
This code was tested by compilation only.

 drivers/net/can/dev.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/net/can/dev.c +2 -3
index 365a8cc..064d0f6 100644
@@ -543,10 +543,9 @@ static void can_restart(struct net_device *dev)
 
 	/* send restart message upstream */
 	skb = alloc_can_err_skb(dev, &cf);
-	if (skb == NULL) {
-		err = -ENOMEM;
+	if (!skb)
 		goto restart;
-	}
+
 	cf->can_id |= CAN_ERR_RESTARTED;
 
 	netif_rx(skb);
Signature · 1 line
2.7.4