From: Pavel Machek <pavel@denx.de>
To: gregkh@linuxfoundation.org, stern@rowland.harvard.edu,
kai.heng.feng@canonical.com, johan@kernel.org,
tomasz@meresinski.eu, jonathan@jdcox.net,
kerneldev@karsmulder.nl, linux-usb@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: [PATCH] USB: quirks: simplify quirk handling.
Date: Mon, 21 Sep 2020 13:30:39 +0200 [thread overview]
Message-ID: <20200921113039.GA19862@duo.ucw.cz> (raw)
[-- Attachment #1: Type: text/plain, Size: 1161 bytes --]
Simplify quirk handling.
Signed-off-by: Pavel Machek (CIP) <pavel@denx.de>
diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c
index f232914de5fd..167b6ac428a3 100644
--- a/drivers/usb/core/quirks.c
+++ b/drivers/usb/core/quirks.c
@@ -56,18 +56,13 @@ static int quirks_param_set(const char *value, const struct kernel_param *kp)
if (val[i] == ',')
quirk_count++;
- if (quirk_list) {
- kfree(quirk_list);
- quirk_list = NULL;
- }
-
+ kfree(quirk_list);
quirk_list = kcalloc(quirk_count, sizeof(struct quirk_entry),
GFP_KERNEL);
if (!quirk_list) {
quirk_count = 0;
- mutex_unlock(&quirk_mutex);
- kfree(val);
- return -ENOMEM;
+ err = -ENOMEM;
+ goto unlock;
}
for (i = 0, p = val; p && *p;) {
@@ -153,7 +148,7 @@ static int quirks_param_set(const char *value, const struct kernel_param *kp)
mutex_unlock(&quirk_mutex);
kfree(val);
- return 0;
+ return err;
}
static const struct kernel_param_ops quirks_param_ops = {
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]
next reply other threads:[~2020-09-21 11:30 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-21 11:30 Pavel Machek [this message]
2020-09-21 11:38 ` [PATCH] USB: quirks: simplify quirk handling Greg KH
2020-09-21 11:47 ` Pavel Machek
2020-09-21 11:52 ` Greg KH
2020-09-23 16:28 ` Kars Mulder
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=20200921113039.GA19862@duo.ucw.cz \
--to=pavel@denx.de \
--cc=gregkh@linuxfoundation.org \
--cc=johan@kernel.org \
--cc=jonathan@jdcox.net \
--cc=kai.heng.feng@canonical.com \
--cc=kerneldev@karsmulder.nl \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=stern@rowland.harvard.edu \
--cc=tomasz@meresinski.eu \
/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;
as well as URLs for NNTP newsgroup(s).