diff options
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 |