ia64/xen-unstable

changeset 14624:64ab7d443549

pciback: check function return values of functions declared with
__must_check post-2.6.18.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
author kfraser@localhost.localdomain
date Wed Mar 28 13:55:01 2007 +0100 (2007-03-28)
parents 72a5f76ac8dd
children 32f532e6c054
files linux-2.6-xen-sparse/drivers/xen/pciback/conf_space_header.c linux-2.6-xen-sparse/drivers/xen/pciback/pci_stub.c
line diff
     1.1 --- a/linux-2.6-xen-sparse/drivers/xen/pciback/conf_space_header.c	Wed Mar 28 13:53:27 2007 +0100
     1.2 +++ b/linux-2.6-xen-sparse/drivers/xen/pciback/conf_space_header.c	Wed Mar 28 13:55:01 2007 +0100
     1.3 @@ -20,11 +20,15 @@ struct pci_bar_info {
     1.4  
     1.5  static int command_write(struct pci_dev *dev, int offset, u16 value, void *data)
     1.6  {
     1.7 +	int err;
     1.8 +
     1.9  	if (!dev->is_enabled && is_enable_cmd(value)) {
    1.10  		if (unlikely(verbose_request))
    1.11  			printk(KERN_DEBUG "pciback: %s: enable\n",
    1.12  			       pci_name(dev));
    1.13 -		pci_enable_device(dev);
    1.14 +		err = pci_enable_device(dev);
    1.15 +		if (err)
    1.16 +			return err;
    1.17  	} else if (dev->is_enabled && !is_enable_cmd(value)) {
    1.18  		if (unlikely(verbose_request))
    1.19  			printk(KERN_DEBUG "pciback: %s: disable\n",
    1.20 @@ -44,7 +48,13 @@ static int command_write(struct pci_dev 
    1.21  			printk(KERN_DEBUG
    1.22  			       "pciback: %s: enable memory-write-invalidate\n",
    1.23  			       pci_name(dev));
    1.24 -		pci_set_mwi(dev);
    1.25 +		err = pci_set_mwi(dev);
    1.26 +		if (err) {
    1.27 +			printk(KERN_WARNING
    1.28 +			       "pciback: %s: cannot enable memory-write-invalidate (%d)\n",
    1.29 +			       pci_name(dev), err);
    1.30 +			value &= ~PCI_COMMAND_INVALIDATE;
    1.31 +		}
    1.32  	}
    1.33  
    1.34  	return pci_write_config_word(dev, offset, value);
     2.1 --- a/linux-2.6-xen-sparse/drivers/xen/pciback/pci_stub.c	Wed Mar 28 13:53:27 2007 +0100
     2.2 +++ b/linux-2.6-xen-sparse/drivers/xen/pciback/pci_stub.c	Wed Mar 28 13:55:01 2007 +0100
     2.3 @@ -805,6 +805,18 @@ static ssize_t permissive_show(struct de
     2.4  
     2.5  DRIVER_ATTR(permissive, S_IRUSR | S_IWUSR, permissive_show, permissive_add);
     2.6  
     2.7 +static void pcistub_exit(void)
     2.8 +{
     2.9 +	driver_remove_file(&pciback_pci_driver.driver, &driver_attr_new_slot);
    2.10 +	driver_remove_file(&pciback_pci_driver.driver,
    2.11 +			   &driver_attr_remove_slot);
    2.12 +	driver_remove_file(&pciback_pci_driver.driver, &driver_attr_slots);
    2.13 +	driver_remove_file(&pciback_pci_driver.driver, &driver_attr_quirks);
    2.14 +	driver_remove_file(&pciback_pci_driver.driver, &driver_attr_permissive);
    2.15 +
    2.16 +	pci_unregister_driver(&pciback_pci_driver);
    2.17 +}
    2.18 +
    2.19  static int __init pcistub_init(void)
    2.20  {
    2.21  	int pos = 0;
    2.22 @@ -845,12 +857,23 @@ static int __init pcistub_init(void)
    2.23  	if (err < 0)
    2.24  		goto out;
    2.25  
    2.26 -	driver_create_file(&pciback_pci_driver.driver, &driver_attr_new_slot);
    2.27 -	driver_create_file(&pciback_pci_driver.driver,
    2.28 -			   &driver_attr_remove_slot);
    2.29 -	driver_create_file(&pciback_pci_driver.driver, &driver_attr_slots);
    2.30 -	driver_create_file(&pciback_pci_driver.driver, &driver_attr_quirks);
    2.31 -	driver_create_file(&pciback_pci_driver.driver, &driver_attr_permissive);
    2.32 +	err = driver_create_file(&pciback_pci_driver.driver,
    2.33 +				 &driver_attr_new_slot);
    2.34 +	if (!err)
    2.35 +		err = driver_create_file(&pciback_pci_driver.driver,
    2.36 +					 &driver_attr_remove_slot);
    2.37 +	if (!err)
    2.38 +		err = driver_create_file(&pciback_pci_driver.driver,
    2.39 +					 &driver_attr_slots);
    2.40 +	if (!err)
    2.41 +		err = driver_create_file(&pciback_pci_driver.driver,
    2.42 +					 &driver_attr_quirks);
    2.43 +	if (!err)
    2.44 +		err = driver_create_file(&pciback_pci_driver.driver,
    2.45 +					 &driver_attr_permissive);
    2.46 +
    2.47 +	if (err)
    2.48 +		pcistub_exit();
    2.49  
    2.50        out:
    2.51  	return err;
    2.52 @@ -887,23 +910,17 @@ static int __init pciback_init(void)
    2.53  #endif
    2.54  
    2.55  	pcistub_init_devices_late();
    2.56 -	pciback_xenbus_register();
    2.57 +	err = pciback_xenbus_register();
    2.58 +	if (err)
    2.59 +		pciback_exit();
    2.60  
    2.61 -	return 0;
    2.62 +	return err;
    2.63  }
    2.64  
    2.65  static void __exit pciback_cleanup(void)
    2.66  {
    2.67  	pciback_xenbus_unregister();
    2.68 -
    2.69 -	driver_remove_file(&pciback_pci_driver.driver, &driver_attr_new_slot);
    2.70 -	driver_remove_file(&pciback_pci_driver.driver,
    2.71 -			   &driver_attr_remove_slot);
    2.72 -	driver_remove_file(&pciback_pci_driver.driver, &driver_attr_slots);
    2.73 -	driver_remove_file(&pciback_pci_driver.driver, &driver_attr_quirks);
    2.74 -	driver_remove_file(&pciback_pci_driver.driver, &driver_attr_permissive);
    2.75 -
    2.76 -	pci_unregister_driver(&pciback_pci_driver);
    2.77 +	pciback_exit();
    2.78  }
    2.79  
    2.80  module_init(pciback_init);