]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
driver core: Delete an unnecessary check before the function call "put_device"
authorMarkus Elfring <elfring@users.sourceforge.net>
Thu, 5 Feb 2015 10:48:26 +0000 (11:48 +0100)
committerWilly Tarreau <w@1wt.eu>
Fri, 10 Feb 2017 10:03:30 +0000 (11:03 +0100)
commit 5f0163a5ee9cc7c59751768bdfd94a73186debba upstream.

The put_device() function tests whether its argument is NULL and then
returns immediately. Thus the test around the call is not needed.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[wt: backported only to ease next patch as suggested by Jiri]

Signed-off-by: Willy Tarreau <w@1wt.eu>
drivers/base/core.c

index 2a19097a7cb19c87ae8a2d0015a41e3edd7b9571..d92ecf393c3828fe68b26c148907d5046aca6016 100644 (file)
@@ -1138,8 +1138,7 @@ done:
        kobject_del(&dev->kobj);
  Error:
        cleanup_device_parent(dev);
-       if (parent)
-               put_device(parent);
+       put_device(parent);
 name_error:
        kfree(dev->p);
        dev->p = NULL;