diff options
Diffstat (limited to 'lib/kobject.c')
-rw-r--r-- | lib/kobject.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/kobject.c b/lib/kobject.c index f2ccdbac8ed9..83198cb37d8d 100644 --- a/lib/kobject.c +++ b/lib/kobject.c | |||
@@ -498,8 +498,10 @@ int kobject_rename(struct kobject *kobj, const char *new_name) | |||
498 | kobj = kobject_get(kobj); | 498 | kobj = kobject_get(kobj); |
499 | if (!kobj) | 499 | if (!kobj) |
500 | return -EINVAL; | 500 | return -EINVAL; |
501 | if (!kobj->parent) | 501 | if (!kobj->parent) { |
502 | kobject_put(kobj); | ||
502 | return -EINVAL; | 503 | return -EINVAL; |
504 | } | ||
503 | 505 | ||
504 | devpath = kobject_get_path(kobj, GFP_KERNEL); | 506 | devpath = kobject_get_path(kobj, GFP_KERNEL); |
505 | if (!devpath) { | 507 | if (!devpath) { |