summaryrefslogtreecommitdiff
path: root/drivers/parport
diff options
context:
space:
mode:
authorPaulo Marques <pmarques@grupopie.com>2005-06-23 11:09:02 +0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-06-23 20:45:18 +0400
commit543537bd922692bc978e2e356fcd8bfc9c2ee7d5 (patch)
tree0089e3907e7d6c17c01cffc6ea4a8962ed053079 /drivers/parport
parent991114c6fa6a21d1fa4d544abe78592352860c82 (diff)
downloadlinux-543537bd922692bc978e2e356fcd8bfc9c2ee7d5.tar.xz
[PATCH] create a kstrdup library function
This patch creates a new kstrdup library function and changes the "local" implementations in several places to use this function. Most of the changes come from the sound and net subsystems. The sound part had already been acknowledged by Takashi Iwai and the net part by David S. Miller. I left UML alone for now because I would need more time to read the code carefully before making changes there. Signed-off-by: Paulo Marques <pmarques@grupopie.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.c18
1 files changed, 5 insertions, 13 deletions
diff --git a/drivers/parport/probe.c b/drivers/parport/probe.c
index c94963145e17..6e6f42d01e64 100644
--- a/drivers/parport/probe.c
+++ b/drivers/parport/probe.c
@@ -48,14 +48,6 @@ static void pretty_print(struct parport *port, int device)
printk("\n");
}
-static char *strdup(char *str)
-{
- int n = strlen(str)+1;
- char *s = kmalloc(n, GFP_KERNEL);
- if (!s) return NULL;
- return strcpy(s, str);
-}
-
static void parse_data(struct parport *port, int device, char *str)
{
char *txt = kmalloc(strlen(str)+1, GFP_KERNEL);
@@ -88,16 +80,16 @@ static void parse_data(struct parport *port, int device, char *str)
if (!strcmp(p, "MFG") || !strcmp(p, "MANUFACTURER")) {
if (info->mfr)
kfree (info->mfr);
- info->mfr = strdup(sep);
+ info->mfr = kstrdup(sep, GFP_KERNEL);
} else if (!strcmp(p, "MDL") || !strcmp(p, "MODEL")) {
if (info->model)
kfree (info->model);
- info->model = strdup(sep);
+ info->model = kstrdup(sep, GFP_KERNEL);
} else if (!strcmp(p, "CLS") || !strcmp(p, "CLASS")) {
int i;
if (info->class_name)
kfree (info->class_name);
- info->class_name = strdup(sep);
+ info->class_name = kstrdup(sep, GFP_KERNEL);
for (u = sep; *u; u++)
*u = toupper(*u);
for (i = 0; classes[i].token; i++) {
@@ -112,7 +104,7 @@ static void parse_data(struct parport *port, int device, char *str)
!strcmp(p, "COMMAND SET")) {
if (info->cmdset)
kfree (info->cmdset);
- info->cmdset = strdup(sep);
+ info->cmdset = kstrdup(sep, GFP_KERNEL);
/* if it speaks printer language, it's
probably a printer */
if (strstr(sep, "PJL") || strstr(sep, "PCL"))
@@ -120,7 +112,7 @@ static void parse_data(struct parport *port, int device, char *str)
} else if (!strcmp(p, "DES") || !strcmp(p, "DESCRIPTION")) {
if (info->description)
kfree (info->description);
- info->description = strdup(sep);
+ info->description = kstrdup(sep, GFP_KERNEL);
}
}
rock_on: