[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAJZ5v0gDviFYu=m2y1Coi7Fo1bj8phM6r-BqBSB6=-VL_n-=TA@mail.gmail.com>
Date: Mon, 3 Aug 2020 13:26:11 +0200
From: "Rafael J. Wysocki" <rafael@...nel.org>
To: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
"Rafael J. Wysocki" <rafael@...nel.org>
Subject: Re: [PATCH v1] kobject: Drop unneeded conditional in __kobject_del()
On Mon, Aug 3, 2020 at 10:35 AM Andy Shevchenko
<andriy.shevchenko@...ux.intel.com> wrote:
>
> __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@...ux.intel.com>
Reviewed-by: Rafael J. Wysocki <rafael.j.wysocki@...el.com>
> ---
>
> 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(-)
>
> diff --git a/lib/kobject.c b/lib/kobject.c
> index 9dce68c378e6..ea53b30cf483 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.27.0
>
Powered by blists - more mailing lists