]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - lib/kobject.c
kobject: replace '/' with '!' in name
[linux-2.6-omap-h63xx.git] / lib / kobject.c
index dcade0543bd2a2395ede8f91bf33438348e54f7e..744401571ed76cbd48717f1aa1970804fc33cd9a 100644 (file)
@@ -216,13 +216,19 @@ static int kobject_add_internal(struct kobject *kobj)
 static int kobject_set_name_vargs(struct kobject *kobj, const char *fmt,
                                  va_list vargs)
 {
-       /* Free the old name, if necessary. */
-       kfree(kobj->name);
+       const char *old_name = kobj->name;
+       char *s;
 
        kobj->name = kvasprintf(GFP_KERNEL, fmt, vargs);
        if (!kobj->name)
                return -ENOMEM;
 
+       /* ewww... some of these buggers have '/' in the name ... */
+       s = strchr(kobj->name, '/');
+       if (s)
+               s[0] = '!';
+
+       kfree(old_name);
        return 0;
 }