lkml.org 
[lkml]   [2020]   [Sep]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH AUTOSEL 4.4 6/8] kobject: Drop unneeded conditional in __kobject_del()
Date
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

[ 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@linux.intel.com>
Reviewed-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Link: https://lore.kernel.org/r/20200803083520.5460-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
lib/kobject.c | 3 ---
1 file changed, 3 deletions(-)

diff --git a/lib/kobject.c b/lib/kobject.c
index cebbe79d2c65c..d278ad01ea660 100644
--- a/lib/kobject.c
+++ b/lib/kobject.c
@@ -568,9 +568,6 @@ void kobject_del(struct kobject *kobj)
{
struct kernfs_node *sd;

- if (!kobj)
- return;
-
sd = kobj->sd;
sysfs_remove_dir(kobj);
sysfs_put(sd);
--
2.25.1
\
 
 \ /
  Last update: 2020-09-14 15:19    [W:0.044 / U:1.148 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site