diff options
author | Andrew Morton <akpm@osdl.org> | 2006-08-15 01:43:17 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2006-09-26 00:08:39 -0400 |
commit | 4a7fb6363f2d1a6c09a10253937f672f3c7929e1 (patch) | |
tree | 46e70fc8baca37ffd901c472ce7ce13338fb4ece /include/linux/pci.h | |
parent | 35acfdd7253025e8441883fd8f879f5240844f95 (diff) |
add __must_check to device management code
We're getting a lot of crashes in the sysfs/kobject/device/bus/class code and
they're very hard to diagnose.
I'm suspecting that in some cases this is because drivers aren't checking
return values and aren't handling errors correctly. So the code blithely
blunders on and crashes later in very obscure ways.
There's just no reason to ignore errors which can and do occur. So the patch
sprinkles __must_check all over these APIs.
Causes 1,513 new warnings. Heh.
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'include/linux/pci.h')
-rw-r--r-- | include/linux/pci.h | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/include/linux/pci.h b/include/linux/pci.h index 9514bbfe96e2..3ec72551ac31 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h | |||
@@ -49,6 +49,7 @@ | |||
49 | #include <linux/types.h> | 49 | #include <linux/types.h> |
50 | #include <linux/ioport.h> | 50 | #include <linux/ioport.h> |
51 | #include <linux/list.h> | 51 | #include <linux/list.h> |
52 | #include <linux/compiler.h> | ||
52 | #include <linux/errno.h> | 53 | #include <linux/errno.h> |
53 | #include <linux/device.h> | 54 | #include <linux/device.h> |
54 | 55 | ||
@@ -403,7 +404,7 @@ extern struct list_head pci_root_buses; /* list of all known PCI buses */ | |||
403 | extern struct list_head pci_devices; /* list of all devices */ | 404 | extern struct list_head pci_devices; /* list of all devices */ |
404 | 405 | ||
405 | void pcibios_fixup_bus(struct pci_bus *); | 406 | void pcibios_fixup_bus(struct pci_bus *); |
406 | int pcibios_enable_device(struct pci_dev *, int mask); | 407 | int __must_check pcibios_enable_device(struct pci_dev *, int mask); |
407 | char *pcibios_setup (char *str); | 408 | char *pcibios_setup (char *str); |
408 | 409 | ||
409 | /* Used only when drivers/pci/setup.c is used */ | 410 | /* Used only when drivers/pci/setup.c is used */ |
@@ -490,19 +491,19 @@ static inline int pci_write_config_dword(struct pci_dev *dev, int where, u32 val | |||
490 | return pci_bus_write_config_dword (dev->bus, dev->devfn, where, val); | 491 | return pci_bus_write_config_dword (dev->bus, dev->devfn, where, val); |
491 | } | 492 | } |
492 | 493 | ||
493 | int pci_enable_device(struct pci_dev *dev); | 494 | int __must_check pci_enable_device(struct pci_dev *dev); |
494 | int pci_enable_device_bars(struct pci_dev *dev, int mask); | 495 | int __must_check pci_enable_device_bars(struct pci_dev *dev, int mask); |
495 | void pci_disable_device(struct pci_dev *dev); | 496 | void pci_disable_device(struct pci_dev *dev); |
496 | void pci_set_master(struct pci_dev *dev); | 497 | void pci_set_master(struct pci_dev *dev); |
497 | #define HAVE_PCI_SET_MWI | 498 | #define HAVE_PCI_SET_MWI |
498 | int pci_set_mwi(struct pci_dev *dev); | 499 | int __must_check pci_set_mwi(struct pci_dev *dev); |
499 | void pci_clear_mwi(struct pci_dev *dev); | 500 | void pci_clear_mwi(struct pci_dev *dev); |
500 | void pci_intx(struct pci_dev *dev, int enable); | 501 | void pci_intx(struct pci_dev *dev, int enable); |
501 | int pci_set_dma_mask(struct pci_dev *dev, u64 mask); | 502 | int pci_set_dma_mask(struct pci_dev *dev, u64 mask); |
502 | int pci_set_consistent_dma_mask(struct pci_dev *dev, u64 mask); | 503 | int pci_set_consistent_dma_mask(struct pci_dev *dev, u64 mask); |
503 | void pci_update_resource(struct pci_dev *dev, struct resource *res, int resno); | 504 | void pci_update_resource(struct pci_dev *dev, struct resource *res, int resno); |
504 | int pci_assign_resource(struct pci_dev *dev, int i); | 505 | int __must_check pci_assign_resource(struct pci_dev *dev, int i); |
505 | int pci_assign_resource_fixed(struct pci_dev *dev, int i); | 506 | int __must_check pci_assign_resource_fixed(struct pci_dev *dev, int i); |
506 | void pci_restore_bars(struct pci_dev *dev); | 507 | void pci_restore_bars(struct pci_dev *dev); |
507 | 508 | ||
508 | /* ROM control related routines */ | 509 | /* ROM control related routines */ |
@@ -528,23 +529,24 @@ void pdev_sort_resources(struct pci_dev *, struct resource_list *); | |||
528 | void pci_fixup_irqs(u8 (*)(struct pci_dev *, u8 *), | 529 | void pci_fixup_irqs(u8 (*)(struct pci_dev *, u8 *), |
529 | int (*)(struct pci_dev *, u8, u8)); | 530 | int (*)(struct pci_dev *, u8, u8)); |
530 | #define HAVE_PCI_REQ_REGIONS 2 | 531 | #define HAVE_PCI_REQ_REGIONS 2 |
531 | int pci_request_regions(struct pci_dev *, const char *); | 532 | int __must_check pci_request_regions(struct pci_dev *, const char *); |
532 | void pci_release_regions(struct pci_dev *); | 533 | void pci_release_regions(struct pci_dev *); |
533 | int pci_request_region(struct pci_dev *, int, const char *); | 534 | int __must_check pci_request_region(struct pci_dev *, int, const char *); |
534 | void pci_release_region(struct pci_dev *, int); | 535 | void pci_release_region(struct pci_dev *, int); |
535 | 536 | ||
536 | /* drivers/pci/bus.c */ | 537 | /* drivers/pci/bus.c */ |
537 | int pci_bus_alloc_resource(struct pci_bus *bus, struct resource *res, | 538 | int __must_check pci_bus_alloc_resource(struct pci_bus *bus, |
538 | resource_size_t size, resource_size_t align, | 539 | struct resource *res, resource_size_t size, |
539 | resource_size_t min, unsigned int type_mask, | 540 | resource_size_t align, resource_size_t min, |
540 | void (*alignf)(void *, struct resource *, | 541 | unsigned int type_mask, |
541 | resource_size_t, resource_size_t), | 542 | void (*alignf)(void *, struct resource *, |
542 | void *alignf_data); | 543 | resource_size_t, resource_size_t), |
544 | void *alignf_data); | ||
543 | void pci_enable_bridges(struct pci_bus *bus); | 545 | void pci_enable_bridges(struct pci_bus *bus); |
544 | 546 | ||
545 | /* Proper probing supporting hot-pluggable devices */ | 547 | /* Proper probing supporting hot-pluggable devices */ |
546 | int __pci_register_driver(struct pci_driver *, struct module *); | 548 | int __must_check __pci_register_driver(struct pci_driver *, struct module *); |
547 | static inline int pci_register_driver(struct pci_driver *driver) | 549 | static inline int __must_check pci_register_driver(struct pci_driver *driver) |
548 | { | 550 | { |
549 | return __pci_register_driver(driver, THIS_MODULE); | 551 | return __pci_register_driver(driver, THIS_MODULE); |
550 | } | 552 | } |