class: use IS_ERR_OR_NULL() helper in class_unregister()
authorYang Yingliang <yangyingliang@huawei.com>
Mon, 22 Aug 2022 06:19:22 +0000 (14:19 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 1 Sep 2022 16:15:40 +0000 (18:15 +0200)
Use IS_ERR_OR_NULL() helper in class_unregister() to simplify code.

Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Link: https://lore.kernel.org/r/20220822061922.3884113-1-yangyingliang@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/base/class.c

index 8feb85e186e3b72450e0c1285c85b4bedbe5eb07..64f7b9a0970f7d5d89559cbb4872079021a14fea 100644 (file)
@@ -260,7 +260,7 @@ EXPORT_SYMBOL_GPL(__class_create);
  */
 void class_destroy(struct class *cls)
 {
-       if ((cls == NULL) || (IS_ERR(cls)))
+       if (IS_ERR_OR_NULL(cls))
                return;
 
        class_unregister(cls);