can: sun4i_can: sun4i_can_err(): call can_change_state() even if cf is NULL
[ Upstream commit ee6bf3677ae03569d833795064e17f605c2163c7 ]
Call the function can_change_state() if the allocation of the skb
fails, as it handles the cf parameter when it is null.
Additionally, this ensures that the statistics related to state error
counters (i. e. warning, passive, and bus-off) are updated.
Fixes: 0738eff14d ("can: Allwinner A10/A20 CAN Controller support - Kernel module")
Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
Link: https://patch.msgid.link/20241122221650.633981-3-dario.binacchi@amarulasolutions.com
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
5ba0a19a6f
commit
f8138cba7b
1 changed files with 4 additions and 4 deletions
|
|
@ -614,10 +614,10 @@ static int sun4i_can_err(struct net_device *dev, u8 isrc, u8 status)
|
||||||
tx_state = txerr >= rxerr ? state : 0;
|
tx_state = txerr >= rxerr ? state : 0;
|
||||||
rx_state = txerr <= rxerr ? state : 0;
|
rx_state = txerr <= rxerr ? state : 0;
|
||||||
|
|
||||||
if (likely(skb))
|
/* The skb allocation might fail, but can_change_state()
|
||||||
can_change_state(dev, cf, tx_state, rx_state);
|
* handles cf == NULL.
|
||||||
else
|
*/
|
||||||
priv->can.state = state;
|
can_change_state(dev, cf, tx_state, rx_state);
|
||||||
if (state == CAN_STATE_BUS_OFF)
|
if (state == CAN_STATE_BUS_OFF)
|
||||||
can_bus_off(dev);
|
can_bus_off(dev);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue