[PATCH AUTOSEL 5.8 17/29] kobject: Drop unneeded conditional in __kobject_del()

From: Sasha Levin
Date: Mon Sep 14 2020 - 13:10:12 EST


From: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>

[ Upstream commit 07ecc6693f9157cf293da5d165c73fb28fd69bf4 ]

__kobject_del() is called from two places, in one where kobj is dereferenced
before and thus can't be NULL, and in the other the NULL check is done before
call. Drop unneeded conditional in __kobject_del().

Signed-off-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
Reviewed-by: Rafael J. Wysocki <rafael.j.wysocki@xxxxxxxxx>
Link: https://lore.kernel.org/r/20200803083520.5460-1-andriy.shevchenko@xxxxxxxxxxxxxxx
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>
---
lib/kobject.c | 3 ---
1 file changed, 3 deletions(-)

diff --git a/lib/kobject.c b/lib/kobject.c
index 3afb939f2a1cc..3a255f14e263e 100644
--- a/lib/kobject.c
+++ b/lib/kobject.c
@@ -604,9 +604,6 @@ static void __kobject_del(struct kobject *kobj)
struct kernfs_node *sd;
const struct kobj_type *ktype;

- if (!kobj)
- return;
-
sd = kobj->sd;
ktype = get_ktype(kobj);

--
2.25.1