Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

PCI: Warn about failures instead of "must_check" functions

These places capture return values to avoid "must_check" warnings,
but we didn't *do* anything with the return values, which causes
"set but not used" warnings. We might as well do something instead
of just trying to evade the "must_check" warnings.

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>

+10 -2
+3
drivers/pci/bus.c
··· 202 202 if (dev->is_added) 203 203 continue; 204 204 retval = pci_bus_add_device(dev); 205 + if (retval) 206 + dev_err(&dev->dev, "Error adding device (%d)\n", 207 + retval); 205 208 } 206 209 207 210 list_for_each_entry(dev, &bus->devices, bus_list) {
+2
drivers/pci/setup-bus.c
··· 1545 1545 1546 1546 enable_all: 1547 1547 retval = pci_reenable_device(bridge); 1548 + if (retval) 1549 + dev_err(&bridge->dev, "Error reenabling bridge (%d)\n", retval); 1548 1550 pci_set_master(bridge); 1549 1551 pci_enable_bridges(parent); 1550 1552 }
+5 -2
drivers/pci/slot.c
··· 377 377 { 378 378 struct hotplug_slot *slot = pci_slot->hotplug; 379 379 struct kobject *kobj = NULL; 380 - int no_warn; 380 + int ret; 381 381 382 382 if (!slot || !slot->ops) 383 383 return; 384 384 kobj = kset_find_obj(module_kset, slot->ops->mod_name); 385 385 if (!kobj) 386 386 return; 387 - no_warn = sysfs_create_link(&pci_slot->kobj, kobj, "module"); 387 + ret = sysfs_create_link(&pci_slot->kobj, kobj, "module"); 388 + if (ret) 389 + dev_err(&pci_slot->bus->dev, "Error creating sysfs link (%d)\n", 390 + ret); 388 391 kobject_put(kobj); 389 392 } 390 393 EXPORT_SYMBOL_GPL(pci_hp_create_module_link);