From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Linus Walleij <linus.walleij@linaro.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Subject: [PATCH v1 2/5] usb: fotg210-hcd: Don't shadow error codes in store()
Date: Fri, 20 Jan 2023 17:44:34 +0200 [thread overview]
Message-ID: <20230120154437.22025-2-andriy.shevchenko@linux.intel.com> (raw)
In-Reply-To: <20230120154437.22025-1-andriy.shevchenko@linux.intel.com>
kstrtox() along with regmap API can return different error codes based on
circumstances.
Don't shadow them when returning to the caller.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/usb/fotg210/fotg210-hcd.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/usb/fotg210/fotg210-hcd.c b/drivers/usb/fotg210/fotg210-hcd.c
index 46752a75c428..5a934f5343a7 100644
--- a/drivers/usb/fotg210/fotg210-hcd.c
+++ b/drivers/usb/fotg210/fotg210-hcd.c
@@ -4702,8 +4702,10 @@ static ssize_t uframe_periodic_max_store(struct device *dev,
ssize_t ret;
fotg210 = hcd_to_fotg210(bus_to_hcd(dev_get_drvdata(dev)));
- if (kstrtouint(buf, 0, &uframe_periodic_max) < 0)
- return -EINVAL;
+
+ ret = kstrtouint(buf, 0, &uframe_periodic_max);
+ if (ret)
+ return ret;
if (uframe_periodic_max < 100 || uframe_periodic_max >= 125) {
fotg210_info(fotg210, "rejecting invalid request for uframe_periodic_max=%u\n",
--
2.39.0
next prev parent reply other threads:[~2023-01-20 15:44 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-20 15:44 [PATCH v1 1/5] usb: fotg210-hcd: use sysfs_emit() to instead of scnprintf() Andy Shevchenko
2023-01-20 15:44 ` Andy Shevchenko [this message]
2023-01-26 20:00 ` [PATCH v1 2/5] usb: fotg210-hcd: Don't shadow error codes in store() Linus Walleij
2023-01-20 15:44 ` [PATCH v1 3/5] usb: fotg210-udc: remove redundant error logging Andy Shevchenko
2023-01-26 20:01 ` Linus Walleij
2023-01-20 15:44 ` [PATCH v1 4/5] usb: fotg210: Switch to use dev_err_probe() Andy Shevchenko
2023-01-26 20:01 ` Linus Walleij
2023-02-16 8:07 ` Christophe JAILLET
2023-02-16 8:30 ` Linus Walleij
2023-01-20 15:44 ` [PATCH v1 5/5] usb: fotg210: use devm_platform_get_and_ioremap_resource() Andy Shevchenko
2023-01-26 20:02 ` Linus Walleij
2023-01-27 8:55 ` Andy Shevchenko
2023-01-27 9:10 ` Linus Walleij
2023-01-27 9:16 ` Andy Shevchenko
2023-01-26 19:59 ` [PATCH v1 1/5] usb: fotg210-hcd: use sysfs_emit() to instead of scnprintf() Linus Walleij
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=20230120154437.22025-2-andriy.shevchenko@linux.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=gregkh@linuxfoundation.org \
--cc=linus.walleij@linaro.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