# HG changeset patch
# User kfraser@xxxxxxxxxxxxxxxxxxxxx
# Date 1175086501 -3600
# Node ID 64ab7d44354915dc74436cb39f6193f967184b02
# Parent 72a5f76ac8dda9e1df38562b51a3da73f10266d9
pciback: check function return values of functions declared with
__must_check post-2.6.18.
Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx>
---
linux-2.6-xen-sparse/drivers/xen/pciback/conf_space_header.c | 14 ++
linux-2.6-xen-sparse/drivers/xen/pciback/pci_stub.c | 53 +++++++----
2 files changed, 47 insertions(+), 20 deletions(-)
diff -r 72a5f76ac8dd -r 64ab7d443549
linux-2.6-xen-sparse/drivers/xen/pciback/conf_space_header.c
--- a/linux-2.6-xen-sparse/drivers/xen/pciback/conf_space_header.c Wed Mar
28 13:53:27 2007 +0100
+++ b/linux-2.6-xen-sparse/drivers/xen/pciback/conf_space_header.c Wed Mar
28 13:55:01 2007 +0100
@@ -20,11 +20,15 @@ struct pci_bar_info {
static int command_write(struct pci_dev *dev, int offset, u16 value, void
*data)
{
+ int err;
+
if (!dev->is_enabled && is_enable_cmd(value)) {
if (unlikely(verbose_request))
printk(KERN_DEBUG "pciback: %s: enable\n",
pci_name(dev));
- pci_enable_device(dev);
+ err = pci_enable_device(dev);
+ if (err)
+ return err;
} else if (dev->is_enabled && !is_enable_cmd(value)) {
if (unlikely(verbose_request))
printk(KERN_DEBUG "pciback: %s: disable\n",
@@ -44,7 +48,13 @@ static int command_write(struct pci_dev
printk(KERN_DEBUG
"pciback: %s: enable memory-write-invalidate\n",
pci_name(dev));
- pci_set_mwi(dev);
+ err = pci_set_mwi(dev);
+ if (err) {
+ printk(KERN_WARNING
+ "pciback: %s: cannot enable
memory-write-invalidate (%d)\n",
+ pci_name(dev), err);
+ value &= ~PCI_COMMAND_INVALIDATE;
+ }
}
return pci_write_config_word(dev, offset, value);
diff -r 72a5f76ac8dd -r 64ab7d443549
linux-2.6-xen-sparse/drivers/xen/pciback/pci_stub.c
--- a/linux-2.6-xen-sparse/drivers/xen/pciback/pci_stub.c Wed Mar 28
13:53:27 2007 +0100
+++ b/linux-2.6-xen-sparse/drivers/xen/pciback/pci_stub.c Wed Mar 28
13:55:01 2007 +0100
@@ -805,6 +805,18 @@ static ssize_t permissive_show(struct de
DRIVER_ATTR(permissive, S_IRUSR | S_IWUSR, permissive_show, permissive_add);
+static void pcistub_exit(void)
+{
+ driver_remove_file(&pciback_pci_driver.driver, &driver_attr_new_slot);
+ driver_remove_file(&pciback_pci_driver.driver,
+ &driver_attr_remove_slot);
+ driver_remove_file(&pciback_pci_driver.driver, &driver_attr_slots);
+ driver_remove_file(&pciback_pci_driver.driver, &driver_attr_quirks);
+ driver_remove_file(&pciback_pci_driver.driver, &driver_attr_permissive);
+
+ pci_unregister_driver(&pciback_pci_driver);
+}
+
static int __init pcistub_init(void)
{
int pos = 0;
@@ -845,12 +857,23 @@ static int __init pcistub_init(void)
if (err < 0)
goto out;
- driver_create_file(&pciback_pci_driver.driver, &driver_attr_new_slot);
- driver_create_file(&pciback_pci_driver.driver,
- &driver_attr_remove_slot);
- driver_create_file(&pciback_pci_driver.driver, &driver_attr_slots);
- driver_create_file(&pciback_pci_driver.driver, &driver_attr_quirks);
- driver_create_file(&pciback_pci_driver.driver, &driver_attr_permissive);
+ err = driver_create_file(&pciback_pci_driver.driver,
+ &driver_attr_new_slot);
+ if (!err)
+ err = driver_create_file(&pciback_pci_driver.driver,
+ &driver_attr_remove_slot);
+ if (!err)
+ err = driver_create_file(&pciback_pci_driver.driver,
+ &driver_attr_slots);
+ if (!err)
+ err = driver_create_file(&pciback_pci_driver.driver,
+ &driver_attr_quirks);
+ if (!err)
+ err = driver_create_file(&pciback_pci_driver.driver,
+ &driver_attr_permissive);
+
+ if (err)
+ pcistub_exit();
out:
return err;
@@ -887,23 +910,17 @@ static int __init pciback_init(void)
#endif
pcistub_init_devices_late();
- pciback_xenbus_register();
-
- return 0;
+ err = pciback_xenbus_register();
+ if (err)
+ pciback_exit();
+
+ return err;
}
static void __exit pciback_cleanup(void)
{
pciback_xenbus_unregister();
-
- driver_remove_file(&pciback_pci_driver.driver, &driver_attr_new_slot);
- driver_remove_file(&pciback_pci_driver.driver,
- &driver_attr_remove_slot);
- driver_remove_file(&pciback_pci_driver.driver, &driver_attr_slots);
- driver_remove_file(&pciback_pci_driver.driver, &driver_attr_quirks);
- driver_remove_file(&pciback_pci_driver.driver, &driver_attr_permissive);
-
- pci_unregister_driver(&pciback_pci_driver);
+ pciback_exit();
}
module_init(pciback_init);
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|