linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] USB: quirks: simplify quirk handling.
@ 2020-09-21 11:30 Pavel Machek
  2020-09-21 11:38 ` Greg KH
  2020-09-23 16:28 ` Kars Mulder
  0 siblings, 2 replies; 5+ messages in thread
From: Pavel Machek @ 2020-09-21 11:30 UTC (permalink / raw)
  To: gregkh, stern, kai.heng.feng, johan, tomasz, jonathan, kerneldev,
	linux-usb, linux-kernel

[-- 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 --]

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

end of thread, other threads:[~2020-09-23 16:41 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-09-21 11:30 [PATCH] USB: quirks: simplify quirk handling Pavel Machek
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

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).