[PATCH] Signed-off-by: Wenyuan Li <2063309626@xxxxxx> spi: hi311x: 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.

From: Wenyuan Li

Date: Tue Mar 10 2026 - 04:20:50 EST


Add a check for the return value and propagate the error accordingly.

Signed-off-by: Wenyuan Li <2063309626@xxxxxx>
---
drivers/net/can/spi/hi311x.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/net/can/spi/hi311x.c b/drivers/net/can/spi/hi311x.c
index e00d3dbc4cf4..f0444b4c5b6e 100644
--- a/drivers/net/can/spi/hi311x.c
+++ b/drivers/net/can/spi/hi311x.c
@@ -755,8 +755,9 @@ static int hi3110_open(struct net_device *net)
return ret;

mutex_lock(&priv->hi3110_lock);
- hi3110_power_enable(priv->transceiver, 1);
-
+ ret = hi3110_power_enable(priv->transceiver, 1);
+ if (ret)
+ goto out_disable;
priv->force_quit = 0;
priv->tx_skb = NULL;
priv->tx_busy = false;
@@ -790,6 +791,7 @@ static int hi3110_open(struct net_device *net)
hi3110_hw_sleep(spi);
out_close:
hi3110_power_enable(priv->transceiver, 0);
+ out_disable:
close_candev(net);
mutex_unlock(&priv->hi3110_lock);
return ret;
--
2.43.0