public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* kobject_add unreachable code
@ 2006-12-29  6:47 Martin Stoilov
  2006-12-29 13:50 ` Olaf Dietsche
  0 siblings, 1 reply; 6+ messages in thread
From: Martin Stoilov @ 2006-12-29  6:47 UTC (permalink / raw)
  To: linux-kernel

The following code in kobject_add
    if (!kobj->k_name)
        kobj->k_name = kobj->name;
    if (!kobj->k_name) {
        pr_debug("kobject attempted to be registered with no name!\n");
        WARN_ON(1);
        return -EINVAL;
    }

doesn't look right to me. The second 'if' statement looks useless after
the assignment in the first one. May be it was meant to be like:
if (!*kobj->k_name)

See the full patch:

--- linux-2.6.20-rc2/lib/kobject.c      2006-12-28 19:59:56.000000000 -0800
+++ linux-2.6.20-rc2.mod/lib/kobject.c  2006-12-28 20:00:25.000000000 -0800
@@ -161,19 +161,19 @@
 int kobject_add(struct kobject * kobj)
 {
        int error = 0;
        struct kobject * parent;

        if (!(kobj = kobject_get(kobj)))
                return -ENOENT;
        if (!kobj->k_name)
                kobj->k_name = kobj->name;
-       if (!kobj->k_name) {
+       if (!*kobj->k_name) {
                pr_debug("kobject attempted to be registered with no
name!\n");
                WARN_ON(1);
                return -EINVAL;
        }
        parent = kobject_get(kobj->parent);


-Martin


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2006-12-29 20:49 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-12-29  6:47 kobject_add unreachable code Martin Stoilov
2006-12-29 13:50 ` Olaf Dietsche
2006-12-29 17:15   ` Martin Stoilov
2006-12-29 17:36     ` Martin Stoilov
2006-12-29 17:45       ` Jan Engelhardt
2006-12-29 20:49       ` Olaf Dietsche

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox