public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] USB: serial: Correct return value on read
@ 2017-11-26 16:18 Gimcuan Hui
  2017-11-27 10:21 ` Johan Hovold
  0 siblings, 1 reply; 3+ messages in thread
From: Gimcuan Hui @ 2017-11-26 16:18 UTC (permalink / raw)
  To: Johan Hovold; +Cc: gregkh, linux-usb, linux-kernel

It's meaningless to return buf[0] on read. Because the caller of this
interface checks the return value negative or not. Instead, we should
return the result variable.

Signed-off-by: Gimcuan Hui <gimcuan@gmail.com>
---
 drivers/usb/serial/ark3116.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/usb/serial/ark3116.c b/drivers/usb/serial/ark3116.c
index 3c544782f60b..bfdbc7164e7b 100644
--- a/drivers/usb/serial/ark3116.c
+++ b/drivers/usb/serial/ark3116.c
@@ -101,11 +101,9 @@ static int ark3116_read_reg(struct usb_serial *serial,
 				reg, result);
 		if (result >= 0)
 			result = -EIO;
-
-		return result;
 	}
 
-	return buf[0];
+	return result;
 }
 
 static inline int calc_divisor(int bps)
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-11-27 14:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-26 16:18 [PATCH] USB: serial: Correct return value on read Gimcuan Hui
2017-11-27 10:21 ` Johan Hovold
2017-11-27 14:21   ` saks cuso

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox