From 6a0033457f2380852a3a4138d4c79571a5b51be6 Mon Sep 17 00:00:00 2001 From: chenqiwu Date: Fri, 14 Feb 2020 17:16:25 +0800 Subject: [PATCH 1/2] drivers/ide: convert to list_for_each_entry_safe() Use list_for_each_entry_safe() instead of list_for_each_safe() to simplify the code. Signed-off-by: chenqiwu Signed-off-by: David S. Miller --- drivers/ide/ide-scan-pci.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/ide/ide-scan-pci.c b/drivers/ide/ide-scan-pci.c index acf874800ca4..383f0d813001 100644 --- a/drivers/ide/ide-scan-pci.c +++ b/drivers/ide/ide-scan-pci.c @@ -89,8 +89,7 @@ static int __init ide_scan_pcidev(struct pci_dev *dev) static int __init ide_scan_pcibus(void) { struct pci_dev *dev = NULL; - struct pci_driver *d; - struct list_head *l, *n; + struct pci_driver *d, *tmp; pre_init = 0; for_each_pci_dev(dev) @@ -101,9 +100,8 @@ static int __init ide_scan_pcibus(void) * are post init. */ - list_for_each_safe(l, n, &ide_pci_drivers) { - list_del(l); - d = list_entry(l, struct pci_driver, node); + list_for_each_entry_safe(d, tmp, &ide_pci_drivers, node) { + list_del(d->node); if (__pci_register_driver(d, d->driver.owner, d->driver.mod_name)) printk(KERN_ERR "%s: failed to register %s driver\n", From 78a515f9faf3af43cf9c4f61254dd1c5b3cb2d0b Mon Sep 17 00:00:00 2001 From: "David S. Miller" Date: Sat, 4 Apr 2020 18:07:59 -0700 Subject: [PATCH 2/2] drivers/ide: Fix build regression. drivers/ide/ide-scan-pci.c: In function 'ide_scan_pcibus': >> drivers/ide/ide-scan-pci.c:104:13: error: incompatible type for argument 1 of 'list_del' 104 | list_del(d->node); | ~^~~~~~ | | | struct list_head In file included from include/linux/module.h:12, from drivers/ide/ide-scan-pci.c:12: include/linux/list.h:144:47: note: expected 'struct list_head *' but argument is of type 'struct list_head' 144 | static inline void list_del(struct list_head *entry) | ~~~~~~~~~~~~~~~~~~^~~~~ Fixes: 6a0033457f23 ("drivers/ide: convert to list_for_each_entry_safe()") Reported-by: kbuild test robot Signed-off-by: David S. Miller --- drivers/ide/ide-scan-pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/ide/ide-scan-pci.c b/drivers/ide/ide-scan-pci.c index 383f0d813001..b0411a1827a3 100644 --- a/drivers/ide/ide-scan-pci.c +++ b/drivers/ide/ide-scan-pci.c @@ -101,7 +101,7 @@ static int __init ide_scan_pcibus(void) */ list_for_each_entry_safe(d, tmp, &ide_pci_drivers, node) { - list_del(d->node); + list_del(&d->node); if (__pci_register_driver(d, d->driver.owner, d->driver.mod_name)) printk(KERN_ERR "%s: failed to register %s driver\n",