[PATCH] can: kvaser_usb: fix return value for hif_usb_send_regout

Chen Ni posted 1 patch 1 year, 8 months ago
drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] can: kvaser_usb: fix return value for hif_usb_send_regout
Posted by Chen Ni 1 year, 8 months ago
As the potential failure of usb_submit_urb(), it should be better to
return the err variable to catch the error.

Signed-off-by: Chen Ni <nichen@iscas.ac.cn>
---
 drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c b/drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c
index 8faf8a462c05..871cd83bcabc 100644
--- a/drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c
+++ b/drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c
@@ -294,7 +294,7 @@ int kvaser_usb_send_cmd_async(struct kvaser_usb_net_priv *priv, void *cmd,
 	}
 	usb_free_urb(urb);
 
-	return 0;
+	return err;
 }
 
 int kvaser_usb_can_rx_over_error(struct net_device *netdev)
-- 
2.25.1
Re: [PATCH] can: kvaser_usb: fix return value for hif_usb_send_regout
Posted by Marc Kleine-Budde 1 year, 7 months ago
On 21.05.2024 12:10:20, Chen Ni wrote:
> As the potential failure of usb_submit_urb(), it should be better to
> return the err variable to catch the error.
> 
> Signed-off-by: Chen Ni <nichen@iscas.ac.cn>

Applied to linux-can.

regards,
Marc

-- 
Pengutronix e.K.                 | Marc Kleine-Budde          |
Embedded Linux                   | https://www.pengutronix.de |
Vertretung Nürnberg              | Phone: +49-5121-206917-129 |
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917-9   |