mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Renzo Davoli <renzo@cs.unibo.it>
To: LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH] fs/char_dev.c: remove useless loop
Date: Mon, 20 Jul 2009 19:38:35 +0200	[thread overview]
Message-ID: <20090720173834.GA14288@cs.unibo.it> (raw)

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@cs.unibo.it>
--
--- 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)

                 reply	other threads:[~2009-07-20 18:00 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090720173834.GA14288@cs.unibo.it \
    --to=renzo@cs.unibo.it \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®