diff options
Diffstat (limited to 'arch/x86_64/kernel/pci-calgary.c')
-rw-r--r-- | arch/x86_64/kernel/pci-calgary.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/arch/x86_64/kernel/pci-calgary.c b/arch/x86_64/kernel/pci-calgary.c index 6c5da1d813f3..7302834718c8 100644 --- a/arch/x86_64/kernel/pci-calgary.c +++ b/arch/x86_64/kernel/pci-calgary.c | |||
@@ -786,6 +786,7 @@ static inline unsigned int __init locate_register_space(struct pci_dev *dev) | |||
786 | 786 | ||
787 | static int __init calgary_init_one_nontraslated(struct pci_dev *dev) | 787 | static int __init calgary_init_one_nontraslated(struct pci_dev *dev) |
788 | { | 788 | { |
789 | pci_dev_get(dev); | ||
789 | dev->sysdata = NULL; | 790 | dev->sysdata = NULL; |
790 | dev->bus->self = dev; | 791 | dev->bus->self = dev; |
791 | 792 | ||
@@ -810,6 +811,7 @@ static int __init calgary_init_one(struct pci_dev *dev) | |||
810 | if (ret) | 811 | if (ret) |
811 | goto iounmap; | 812 | goto iounmap; |
812 | 813 | ||
814 | pci_dev_get(dev); | ||
813 | dev->bus->self = dev; | 815 | dev->bus->self = dev; |
814 | calgary_enable_translation(dev); | 816 | calgary_enable_translation(dev); |
815 | 817 | ||
@@ -836,10 +838,9 @@ static int __init calgary_init(void) | |||
836 | calgary_init_one_nontraslated(dev); | 838 | calgary_init_one_nontraslated(dev); |
837 | continue; | 839 | continue; |
838 | } | 840 | } |
839 | if (!bus_info[dev->bus->number].tce_space && !translate_empty_slots) { | 841 | if (!bus_info[dev->bus->number].tce_space && !translate_empty_slots) |
840 | pci_dev_put(dev); | ||
841 | continue; | 842 | continue; |
842 | } | 843 | |
843 | ret = calgary_init_one(dev); | 844 | ret = calgary_init_one(dev); |
844 | if (ret) | 845 | if (ret) |
845 | goto error; | 846 | goto error; |
@@ -860,9 +861,10 @@ error: | |||
860 | } | 861 | } |
861 | if (!bus_info[dev->bus->number].tce_space && !translate_empty_slots) | 862 | if (!bus_info[dev->bus->number].tce_space && !translate_empty_slots) |
862 | continue; | 863 | continue; |
864 | |||
863 | calgary_disable_translation(dev); | 865 | calgary_disable_translation(dev); |
864 | calgary_free_bus(dev); | 866 | calgary_free_bus(dev); |
865 | pci_dev_put(dev); | 867 | pci_dev_put(dev); /* Undo calgary_init_one()'s pci_dev_get() */ |
866 | } | 868 | } |
867 | 869 | ||
868 | return ret; | 870 | return ret; |