PNP: pnpbios: Use list_for_each_entry() instead of list_for_each()
authorZou Wei <zou_wei@huawei.com>
Tue, 8 Jun 2021 12:35:32 +0000 (20:35 +0800)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Wed, 9 Jun 2021 13:04:30 +0000 (15:04 +0200)
Use list_for_each_entry() instead of list_for_each() where
applicable.

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Zou Wei <zou_wei@huawei.com>
[ rjw: Subject and changelog rewrite ]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/pnp/pnpbios/core.c

index 9b760e73ee8f20a51f2d19b797e9668af83392ad..669ef4700c1ac2bdb9c94ac5f4300d4354f70ea7 100644 (file)
@@ -298,14 +298,12 @@ struct pnp_protocol pnpbios_protocol = {
 
 static int __init insert_device(struct pnp_bios_node *node)
 {
-       struct list_head *pos;
        struct pnp_dev *dev;
        char id[8];
        int error;
 
        /* check if the device is already added */
-       list_for_each(pos, &pnpbios_protocol.devices) {
-               dev = list_entry(pos, struct pnp_dev, protocol_list);
+       list_for_each_entry(dev, &pnpbios_protocol.devices, protocol_list) {
                if (dev->number == node->handle)
                        return -EEXIST;
        }