USB: quirks: simplify quirk handling.
PATCH 1/1 USB: quirks: simplify quirk handling.
Simplify quirk handling.
drivers/usb/core/quirks.c +4 -9
@@ -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 = {
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Greg KH
maintainerQuoted 1 line · Pavel Machek
Simplify quirk handling.
In what way?
Please be more descriptive in your changelog and resend.
thanks,
greg k-h
Quoted 6 lines · Greg KH
Quoted 1 line · Pavel Machek
Simplify quirk handling.
In what way?
Please be more descriptive in your changelog and resend.
Have you looked at the patch below? Please apply the patch. You are free to edit the changelog if you feel the need.
Pavel
Signature · 2 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Greg KH
maintainerQuoted 10 lines · Pavel Machek
Quoted 6 lines · Greg KH
Quoted 1 line · Pavel Machek
Simplify quirk handling.
In what way?
Please be more descriptive in your changelog and resend.
Have you looked at the patch below? Please apply the patch. You are free to edit the changelog if you feel the need.
I am also free to ignore patches with changelogs that do not say anything of consequence, which I will do here.
greg k-h
Quoted 1 line · Pavel Machek
Simplify quirk handling.
This patch seems to contain two different "simplifications" in one. I have no objections against the first simplification:
- if (quirk_list) {
- kfree(quirk_list);
- quirk_list = NULL;
- }
-
+ kfree(quirk_list);
quirk_list = kcalloc(quirk_count, sizeof(struct quirk_entry),
GFP_KERNEL);
Since kfree() does nothing to nullpointers, all lines that are cut seem to be superfluous.
The second simplification does not seem to introduce any new bugs as far as I can tell. Due to lack of experience, I shall refrain from commenting on whether or not it simplifies things.