Commit 8f3ec204 authored by Marc Kleine-Budde's avatar Marc Kleine-Budde

can: dev: can_restart(): reverse logic to remove need for goto

Reverse the logic in the if statement and eliminate the need for a
goto to simplify code readability.

Link: https://lore.kernel.org/all/20231005-can-dev-fix-can-restart-v2-3-91b5c1fd922c@pengutronix.deReviewed-by: default avatarVincent Mailhol <mailhol.vincent@wanadoo.fr>
Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
parent 6841cab8
......@@ -142,14 +142,11 @@ static void can_restart(struct net_device *dev)
/* send restart message upstream */
skb = alloc_can_err_skb(dev, &cf);
if (!skb)
goto restart;
if (skb) {
cf->can_id |= CAN_ERR_RESTARTED;
netif_rx(skb);
}
restart:
netdev_dbg(dev, "restarted\n");
priv->can_stats.restarts++;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment