From: Gimcuan Hui <gimcuan@gmail.com>
To: Johan Hovold <johan@kernel.org>
Cc: gregkh@linuxfoundation.org, linux-usb@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: [PATCH] USB: serial: Correct return value on read
Date: Sun, 26 Nov 2017 16:18:51 +0000 [thread overview]
Message-ID: <20171126161851.25650-1-gimcuan@gmail.com> (raw)
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
next reply other threads:[~2017-11-26 16:19 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-26 16:18 Gimcuan Hui [this message]
2017-11-27 10:21 ` Johan Hovold
2017-11-27 14:21 ` saks cuso
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20171126161851.25650-1-gimcuan@gmail.com \
--to=gimcuan@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=johan@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome