driver core: use IS_ERR_OR_NULL() helper in device_create_groups_vargs()
authorYang Yingliang <yangyingliang@huawei.com>
Wed, 14 Sep 2022 14:07:53 +0000 (22:07 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 24 Sep 2022 13:00:38 +0000 (15:00 +0200)
Use IS_ERR_OR_NULL() helper in device_create_groups_vargs() to simplify code
and improve readiblity. No functional change.

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

index e168408..d025019 100644 (file)
@@ -4170,7 +4170,7 @@ device_create_groups_vargs(struct class *class, struct device *parent,
        struct device *dev = NULL;
        int retval = -ENODEV;
 
-       if (class == NULL || IS_ERR(class))
+       if (IS_ERR_OR_NULL(class))
                goto error;
 
        dev = kzalloc(sizeof(*dev), GFP_KERNEL);