Linux-USB Archive on lore.kernel.org
 help / color / Atom feed
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
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 --]

             reply index

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 ` 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

Linux-USB Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-usb/0 linux-usb/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-usb linux-usb/ https://lore.kernel.org/linux-usb \
		linux-usb@vger.kernel.org
	public-inbox-index linux-usb

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-usb


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git