Re: kobject_add unreachable code

From: Olaf Dietsche
Date: Fri Dec 29 2006 - 08:57:08 EST

Martin Stoilov <mstoilov@xxxxxxxxxx> writes:

> 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)

The second test is true, if kobj->name is NULL as well.

Regards, Olaf.
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at