diff options
author | Jesper Juhl <jesper.juhl@gmail.com> | 2005-11-07 04:01:32 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-11-07 10:54:05 -0500 |
commit | 6044ec8882c726e325017bd948aa0cd94ad33abc (patch) | |
tree | 3bfc5dc93434e8ad556540f6689abcd2699aa45d /drivers/parport/probe.c | |
parent | 2ea7533060e361810c21b2f5ee02151c4dfb85d8 (diff) |
[PATCH] kfree cleanup: misc remaining drivers
This is the remaining misc drivers/ part of the big kfree cleanup patch.
Remove pointless checks for NULL prior to calling kfree() in misc files in
drivers/.
Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com>
Acked-by: Aristeu Sergio Rozanski Filho <aris@cathedrallabs.org>
Acked-by: Roland Dreier <rolandd@cisco.com>
Acked-by: Pierre Ossman <drzeus@drzeus.cx>
Acked-by: Jean Delvare <khali@linux-fr.org>
Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
Acked-by: Len Brown <len.brown@intel.com>
Acked-by: "Antonino A. Daplas" <adaplas@gmail.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/parport/probe.c')
-rw-r--r-- | drivers/parport/probe.c | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/drivers/parport/probe.c b/drivers/parport/probe.c index 6e6f42d01e64..4b48b31ec235 100644 --- a/drivers/parport/probe.c +++ b/drivers/parport/probe.c | |||
@@ -78,17 +78,15 @@ static void parse_data(struct parport *port, int device, char *str) | |||
78 | u++; | 78 | u++; |
79 | } | 79 | } |
80 | if (!strcmp(p, "MFG") || !strcmp(p, "MANUFACTURER")) { | 80 | if (!strcmp(p, "MFG") || !strcmp(p, "MANUFACTURER")) { |
81 | if (info->mfr) | 81 | kfree(info->mfr); |
82 | kfree (info->mfr); | ||
83 | info->mfr = kstrdup(sep, GFP_KERNEL); | 82 | info->mfr = kstrdup(sep, GFP_KERNEL); |
84 | } else if (!strcmp(p, "MDL") || !strcmp(p, "MODEL")) { | 83 | } else if (!strcmp(p, "MDL") || !strcmp(p, "MODEL")) { |
85 | if (info->model) | 84 | kfree(info->model); |
86 | kfree (info->model); | ||
87 | info->model = kstrdup(sep, GFP_KERNEL); | 85 | info->model = kstrdup(sep, GFP_KERNEL); |
88 | } else if (!strcmp(p, "CLS") || !strcmp(p, "CLASS")) { | 86 | } else if (!strcmp(p, "CLS") || !strcmp(p, "CLASS")) { |
89 | int i; | 87 | int i; |
90 | if (info->class_name) | 88 | |
91 | kfree (info->class_name); | 89 | kfree(info->class_name); |
92 | info->class_name = kstrdup(sep, GFP_KERNEL); | 90 | info->class_name = kstrdup(sep, GFP_KERNEL); |
93 | for (u = sep; *u; u++) | 91 | for (u = sep; *u; u++) |
94 | *u = toupper(*u); | 92 | *u = toupper(*u); |
@@ -102,21 +100,22 @@ static void parse_data(struct parport *port, int device, char *str) | |||
102 | info->class = PARPORT_CLASS_OTHER; | 100 | info->class = PARPORT_CLASS_OTHER; |
103 | } else if (!strcmp(p, "CMD") || | 101 | } else if (!strcmp(p, "CMD") || |
104 | !strcmp(p, "COMMAND SET")) { | 102 | !strcmp(p, "COMMAND SET")) { |
105 | if (info->cmdset) | 103 | kfree(info->cmdset); |
106 | kfree (info->cmdset); | ||
107 | info->cmdset = kstrdup(sep, GFP_KERNEL); | 104 | info->cmdset = kstrdup(sep, GFP_KERNEL); |
108 | /* if it speaks printer language, it's | 105 | /* if it speaks printer language, it's |
109 | probably a printer */ | 106 | probably a printer */ |
110 | if (strstr(sep, "PJL") || strstr(sep, "PCL")) | 107 | if (strstr(sep, "PJL") || strstr(sep, "PCL")) |
111 | guessed_class = PARPORT_CLASS_PRINTER; | 108 | guessed_class = PARPORT_CLASS_PRINTER; |
112 | } else if (!strcmp(p, "DES") || !strcmp(p, "DESCRIPTION")) { | 109 | } else if (!strcmp(p, "DES") || !strcmp(p, "DESCRIPTION")) { |
113 | if (info->description) | 110 | kfree(info->description); |
114 | kfree (info->description); | ||
115 | info->description = kstrdup(sep, GFP_KERNEL); | 111 | info->description = kstrdup(sep, GFP_KERNEL); |
116 | } | 112 | } |
117 | } | 113 | } |
118 | rock_on: | 114 | rock_on: |
119 | if (q) p = q+1; else p=NULL; | 115 | if (q) |
116 | p = q + 1; | ||
117 | else | ||
118 | p = NULL; | ||
120 | } | 119 | } |
121 | 120 | ||
122 | /* If the device didn't tell us its class, maybe we have managed to | 121 | /* If the device didn't tell us its class, maybe we have managed to |