X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=lib%2Fkobject.c;h=057921c5945a551777f56706b397c5e4f737aaf3;hb=8140a90ec180192b202af086e7a582e5937c5580;hp=2782f49e906ec3e2315028041ca54681239e55a7;hpb=fe6af6faec078ec8137631f24cb541f9918244f0;p=linux-2.6 diff --git a/lib/kobject.c b/lib/kobject.c index 2782f49e90..057921c594 100644 --- a/lib/kobject.c +++ b/lib/kobject.c @@ -171,7 +171,7 @@ int kobject_shadow_add(struct kobject * kobj, struct dentry *shadow_parent) 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; @@ -326,6 +326,7 @@ int kobject_rename(struct kobject * kobj, const char *new_name) /** * kobject_rename - change the name of an object * @kobj: object in question. + * @new_parent: object's new parent * @new_name: object's new name */ @@ -384,9 +385,11 @@ int kobject_move(struct kobject *kobj, struct kobject *new_parent) goto out; old_parent = kobj->parent; kobj->parent = new_parent; + new_parent = NULL; kobject_put(old_parent); kobject_uevent_env(kobj, KOBJ_MOVE, envp); out: + kobject_put(new_parent); kobject_put(kobj); kfree(devpath_string); kfree(devpath);