[PATCH 2/4] net: ch9200: remove extraneous return in control_write() to propagate failures

Qasim Ijaz posted 4 patches 9 months ago
[PATCH 2/4] net: ch9200: remove extraneous return in control_write() to propagate failures
Posted by Qasim Ijaz 9 months ago
The control_write() function sets err to -EINVAL however there 
is an incorrectly placed 'return 0' statement after it which stops 
the propogation of the error.

Fix this issue by removing the 'return 0'.

Fixes: 4a476bd6d1d9 ("usbnet: New driver for QinHeng CH9200 devices")
Signed-off-by: Qasim Ijaz <qasdev00@gmail.com>
---
 drivers/net/usb/ch9200.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/net/usb/ch9200.c b/drivers/net/usb/ch9200.c
index a206ffa76f1b..3a81e9e96fd3 100644
--- a/drivers/net/usb/ch9200.c
+++ b/drivers/net/usb/ch9200.c
@@ -168,8 +168,6 @@ static int control_write(struct usbnet *dev, unsigned char request,
 		err = -EINVAL;
 	kfree(buf);
 
-	return 0;
-
 err_out:
 	return err;
 }
-- 
2.39.5
Re: [PATCH 2/4] net: ch9200: remove extraneous return in control_write() to propagate failures
Posted by Simon Horman 9 months ago
On Wed, Mar 19, 2025 at 11:21:54AM +0000, Qasim Ijaz wrote:
> The control_write() function sets err to -EINVAL however there 
> is an incorrectly placed 'return 0' statement after it which stops 
> the propogation of the error.
> 
> Fix this issue by removing the 'return 0'.
> 
> Fixes: 4a476bd6d1d9 ("usbnet: New driver for QinHeng CH9200 devices")
> Signed-off-by: Qasim Ijaz <qasdev00@gmail.com>

Reviewed-by: Simon Horman <horms@kernel.org>