Skip to content

Commit 47bba09

Browse files
vanyuan599marckleinebudde
authored andcommitted
can: hi311x: hi3110_open(): add check for hi3110_power_enable() return value
In hi3110_open(), the return value of hi3110_power_enable() is not checked. If power enable fails, the device may not function correctly, while the driver still returns success. Add a check for the return value and propagate the error accordingly. Signed-off-by: Wenyuan Li <2063309626@qq.com> Link: https://patch.msgid.link/tencent_B5E2E7528BB28AA8A2A56E16C49BD58B8B07@qq.com Fixes: 57e83fb ("can: hi311x: Add Holt HI-311x CAN driver") [mkl: adjust subject, commit message and jump label] Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
1 parent 1eea469 commit 47bba09

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

drivers/net/can/spi/hi311x.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -755,7 +755,9 @@ static int hi3110_open(struct net_device *net)
755755
return ret;
756756

757757
mutex_lock(&priv->hi3110_lock);
758-
hi3110_power_enable(priv->transceiver, 1);
758+
ret = hi3110_power_enable(priv->transceiver, 1);
759+
if (ret)
760+
goto out_close_candev;
759761

760762
priv->force_quit = 0;
761763
priv->tx_skb = NULL;
@@ -790,6 +792,7 @@ static int hi3110_open(struct net_device *net)
790792
hi3110_hw_sleep(spi);
791793
out_close:
792794
hi3110_power_enable(priv->transceiver, 0);
795+
out_close_candev:
793796
close_candev(net);
794797
mutex_unlock(&priv->hi3110_lock);
795798
return ret;

0 commit comments

Comments
 (0)