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 | |
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')
-rw-r--r-- | drivers/parport/probe.c | 21 | ||||
-rw-r--r-- | drivers/parport/share.c | 19 |
2 files changed, 17 insertions, 23 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 |
diff --git a/drivers/parport/share.c b/drivers/parport/share.c index ae7becf7efa5..9cb3ab156b09 100644 --- a/drivers/parport/share.c +++ b/drivers/parport/share.c | |||
@@ -202,16 +202,11 @@ static void free_port (struct parport *port) | |||
202 | list_del(&port->full_list); | 202 | list_del(&port->full_list); |
203 | spin_unlock(&full_list_lock); | 203 | spin_unlock(&full_list_lock); |
204 | for (d = 0; d < 5; d++) { | 204 | for (d = 0; d < 5; d++) { |
205 | if (port->probe_info[d].class_name) | 205 | kfree(port->probe_info[d].class_name); |
206 | kfree (port->probe_info[d].class_name); | 206 | kfree(port->probe_info[d].mfr); |
207 | if (port->probe_info[d].mfr) | 207 | kfree(port->probe_info[d].model); |
208 | kfree (port->probe_info[d].mfr); | 208 | kfree(port->probe_info[d].cmdset); |
209 | if (port->probe_info[d].model) | 209 | kfree(port->probe_info[d].description); |
210 | kfree (port->probe_info[d].model); | ||
211 | if (port->probe_info[d].cmdset) | ||
212 | kfree (port->probe_info[d].cmdset); | ||
213 | if (port->probe_info[d].description) | ||
214 | kfree (port->probe_info[d].description); | ||
215 | } | 210 | } |
216 | 211 | ||
217 | kfree(port->name); | 212 | kfree(port->name); |
@@ -618,9 +613,9 @@ parport_register_device(struct parport *port, const char *name, | |||
618 | return tmp; | 613 | return tmp; |
619 | 614 | ||
620 | out_free_all: | 615 | out_free_all: |
621 | kfree (tmp->state); | 616 | kfree(tmp->state); |
622 | out_free_pardevice: | 617 | out_free_pardevice: |
623 | kfree (tmp); | 618 | kfree(tmp); |
624 | out: | 619 | out: |
625 | parport_put_port (port); | 620 | parport_put_port (port); |
626 | module_put(port->ops->owner); | 621 | module_put(port->ops->owner); |