diff options
author | Marc Kleine-Budde <mkl@pengutronix.de> | 2023-09-29 09:47:38 +0200 |
---|---|---|
committer | Marc Kleine-Budde <mkl@pengutronix.de> | 2023-10-05 21:32:45 +0200 |
commit | 8f3ec204d340af183fb2bb21b8e797ac2ed012b2 (patch) | |
tree | 58bdb2a196c3757d4605f35f4d95fbf69cc0f496 /drivers/net/can/dev | |
parent | 6841cab8c4504835e4011689cbdb3351dec693fd (diff) |
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.de
Reviewed-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Diffstat (limited to 'drivers/net/can/dev')
-rw-r--r-- | drivers/net/can/dev/dev.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/drivers/net/can/dev/dev.c b/drivers/net/can/dev/dev.c index 735d5de3caa0..9014256c486a 100644 --- a/drivers/net/can/dev/dev.c +++ b/drivers/net/can/dev/dev.c @@ -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; - - cf->can_id |= CAN_ERR_RESTARTED; - - netif_rx(skb); + if (skb) { + cf->can_id |= CAN_ERR_RESTARTED; + netif_rx(skb); + } -restart: netdev_dbg(dev, "restarted\n"); priv->can_stats.restarts++; |