kobject: Drop unneeded conditional in __kobject_del()
Subsystems (2)
PATCH 1/1 kobject: Drop unneeded conditional in __kobject_del()
__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().
---
It is possible after refactoring kobject_del(). Though I decided to do it in a separate change (no need to backport) for better test coverage.
lib/kobject.c | 3 --- 1 file changed, 3 deletions(-)
lib/kobject.c +0 -3
@@ -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);
Signature · 1 line
2.27.0
Quoted 6 lines · Andy Shevchenko
__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 <[email protected]>
Quoted 25 lines
---
It is possible after refactoring
kobject_del(). Though I decided to do it in a separate change (no need to backport) for better test coverage.lib/kobject.c | 3 --- 1 file changed, 3 deletions(-)lib/kobject.c +0
-4@@ -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.27.0