aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pci')
-rw-r--r--drivers/pci/hotplug/shpchp_hpc.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/drivers/pci/hotplug/shpchp_hpc.c b/drivers/pci/hotplug/shpchp_hpc.c
index bbe450f098e6..83a5226ba9ed 100644
--- a/drivers/pci/hotplug/shpchp_hpc.c
+++ b/drivers/pci/hotplug/shpchp_hpc.c
@@ -1118,7 +1118,7 @@ int shpc_init(struct controller * ctrl, struct pci_dev * pdev)
1118{ 1118{
1119 struct php_ctlr_state_s *php_ctlr, *p; 1119 struct php_ctlr_state_s *php_ctlr, *p;
1120 void *instance_id = ctrl; 1120 void *instance_id = ctrl;
1121 int rc, num_slots = 0; 1121 int rc = -1, num_slots = 0;
1122 u8 hp_slot; 1122 u8 hp_slot;
1123 u32 shpc_base_offset; 1123 u32 shpc_base_offset;
1124 u32 tempdword, slot_reg, slot_config; 1124 u32 tempdword, slot_reg, slot_config;
@@ -1184,11 +1184,15 @@ int shpc_init(struct controller * ctrl, struct pci_dev * pdev)
1184 info("HPC vendor_id %x device_id %x ss_vid %x ss_did %x\n", pdev->vendor, pdev->device, pdev->subsystem_vendor, 1184 info("HPC vendor_id %x device_id %x ss_vid %x ss_did %x\n", pdev->vendor, pdev->device, pdev->subsystem_vendor,
1185 pdev->subsystem_device); 1185 pdev->subsystem_device);
1186 1186
1187 if (pci_enable_device(pdev)) 1187 rc = pci_enable_device(pdev);
1188 if (rc) {
1189 err("%s: pci_enable_device failed\n", __FUNCTION__);
1188 goto abort_free_ctlr; 1190 goto abort_free_ctlr;
1191 }
1189 1192
1190 if (!request_mem_region(ctrl->mmio_base, ctrl->mmio_size, MY_NAME)) { 1193 if (!request_mem_region(ctrl->mmio_base, ctrl->mmio_size, MY_NAME)) {
1191 err("%s: cannot reserve MMIO region\n", __FUNCTION__); 1194 err("%s: cannot reserve MMIO region\n", __FUNCTION__);
1195 rc = -1;
1192 goto abort_free_ctlr; 1196 goto abort_free_ctlr;
1193 } 1197 }
1194 1198
@@ -1197,6 +1201,7 @@ int shpc_init(struct controller * ctrl, struct pci_dev * pdev)
1197 err("%s: cannot remap MMIO region %lx @ %lx\n", __FUNCTION__, 1201 err("%s: cannot remap MMIO region %lx @ %lx\n", __FUNCTION__,
1198 ctrl->mmio_size, ctrl->mmio_base); 1202 ctrl->mmio_size, ctrl->mmio_base);
1199 release_mem_region(ctrl->mmio_base, ctrl->mmio_size); 1203 release_mem_region(ctrl->mmio_base, ctrl->mmio_size);
1204 rc = -1;
1200 goto abort_free_ctlr; 1205 goto abort_free_ctlr;
1201 } 1206 }
1202 dbg("%s: php_ctlr->creg %p\n", __FUNCTION__, php_ctlr->creg); 1207 dbg("%s: php_ctlr->creg %p\n", __FUNCTION__, php_ctlr->creg);
@@ -1299,8 +1304,10 @@ int shpc_init(struct controller * ctrl, struct pci_dev * pdev)
1299 */ 1304 */
1300 if (atomic_add_return(1, &shpchp_num_controllers) == 1) { 1305 if (atomic_add_return(1, &shpchp_num_controllers) == 1) {
1301 shpchp_wq = create_singlethread_workqueue("shpchpd"); 1306 shpchp_wq = create_singlethread_workqueue("shpchpd");
1302 if (!shpchp_wq) 1307 if (!shpchp_wq) {
1303 return -ENOMEM; 1308 rc = -ENOMEM;
1309 goto abort_free_ctlr;
1310 }
1304 } 1311 }
1305 1312
1306 /* 1313 /*
@@ -1330,8 +1337,10 @@ int shpc_init(struct controller * ctrl, struct pci_dev * pdev)
1330 1337
1331 /* We end up here for the many possible ways to fail this API. */ 1338 /* We end up here for the many possible ways to fail this API. */
1332abort_free_ctlr: 1339abort_free_ctlr:
1340 if (php_ctlr->creg)
1341 iounmap(php_ctlr->creg);
1333 kfree(php_ctlr); 1342 kfree(php_ctlr);
1334abort: 1343abort:
1335 DBG_LEAVE_ROUTINE 1344 DBG_LEAVE_ROUTINE
1336 return -1; 1345 return rc;
1337} 1346}