edd: simplify the check of 'attr->test' in edd_populate_dir()
authorYang Yingliang <yangyingliang@huawei.com>
Wed, 11 May 2022 06:46:22 +0000 (14:46 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 19 May 2022 16:57:04 +0000 (18:57 +0200)
attr->test check is not needed when !attr->test is false.

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

index 69353dd0ea2210680c09450ef43ac64e7b088946..5cc238916551a7e5e2134188eb0f587fea8bab6a 100644 (file)
@@ -685,8 +685,7 @@ static void edd_populate_dir(struct edd_device * edev)
        int i;
 
        for (i = 0; (attr = edd_attrs[i]) && !error; i++) {
-               if (!attr->test ||
-                   (attr->test && attr->test(edev)))
+               if (!attr->test || attr->test(edev))
                        error = sysfs_create_file(&edev->kobj,&attr->attr);
        }