lkml.org 
[lkml]   [2006]   [Dec]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subjectkobject_add unreachable code
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

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
\
 
 \ /
  Last update: 2006-12-29 08:51    [W:0.041 / U:0.620 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site