Skip to content

Commit dd5d81f

Browse files
rd235torvalds
authored andcommitted
fs/char_dev.c: remove useless loop
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. [hidave.darkstar@gmail.com: fix warning, remove the unused char *s] Signed-off-by: Renzo Davoli <renzo@cs.unibo.it> Cc: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Dave Young <hidave.darkstar@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent bb521c5 commit dd5d81f

1 file changed

Lines changed: 0 additions & 3 deletions

File tree

‎fs/char_dev.c‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,6 @@ int __register_chrdev(unsigned int major, unsigned int baseminor,
264264
{
265265
struct char_device_struct *cd;
266266
struct cdev *cdev;
267-
char *s;
268267
int err = -ENOMEM;
269268

270269
cd = __register_chrdev_region(major, baseminor, count, name);
@@ -278,8 +277,6 @@ int __register_chrdev(unsigned int major, unsigned int baseminor,
278277
cdev->owner = fops->owner;
279278
cdev->ops = fops;
280279
kobject_set_name(&cdev->kobj, "%s", name);
281-
for (s = strchr(kobject_name(&cdev->kobj),'/'); s; s = strchr(s, '/'))
282-
*s = '!';
283280

284281
err = cdev_add(cdev, MKDEV(cd->major, baseminor), count);
285282
if (err)

0 commit comments

Comments
 (0)