[PATCH] fs/char_dev.c: remove useless loop

From: Renzo Davoli
Date: Mon Jul 20 2009 - 14:00:44 EST


There are two useless lines in fs/char_dev.c.

In register_chrdev there is a loop to change all '/' into '!' in the
kernel object name.
This code is useless as the same substitution is in kobject_set_name_vargs in
lib/kobject.c:
228 /* ewww... some of these buggers have '/' in the name ... */
229 while ((s = strchr(kobj->name, '/')))
230 s[0] = '!';

kobject_set_name_vargs is called by kobject_set_name.
kobject_set_name is called just above the useless loop.

renzo

Signed-off-by: Renzo Davoli <renzo@xxxxxxxxxxx>
--
--- a/fs/char_dev.c 2009-07-20 19:06:51.000000000 +0200
+++ b/fs/char_dev.c 2009-07-20 19:14:26.000000000 +0200
@@ -278,8 +278,6 @@
cdev->owner = fops->owner;
cdev->ops = fops;
kobject_set_name(&cdev->kobj, "%s", name);
- for (s = strchr(kobject_name(&cdev->kobj),'/'); s; s = strchr(s, '/'))
- *s = '!';

err = cdev_add(cdev, MKDEV(cd->major, 0), 256);
if (err)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/