aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQuentin Lambert <lambert.quentin@gmail.com>2014-09-07 14:03:32 -0400
committerBjorn Helgaas <bhelgaas@google.com>2014-09-24 09:50:53 -0400
commit79e50e72986c9fcb06d707ce587cfd24fefa33e3 (patch)
tree1a21fd09d544924c1bc1417840a8569821820516
parent656f978f9af9d8d77436e8159f51f7aa1e673309 (diff)
PCI: Remove assignment from "if" conditions
The following Coccinelle semantic patch was used to find and correct cases of assignments in "if" conditions: @@ expression var, expr; statement S; @@ + var = expr; if( - (var = expr) + var ) S Signed-off-by: Quentin Lambert <lambert.quentin@gmail.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
-rw-r--r--drivers/pci/hotplug/acpi_pcihp.c3
-rw-r--r--drivers/pci/hotplug/cpci_hotplug_core.c9
-rw-r--r--drivers/pci/hotplug/cpcihp_zt5550.c5
-rw-r--r--drivers/pci/hotplug/ibmphp_core.c15
-rw-r--r--drivers/pci/hotplug/ibmphp_pci.c6
-rw-r--r--drivers/pci/hotplug/ibmphp_res.c30
-rw-r--r--drivers/pci/hotplug/shpchp_ctrl.c12
-rw-r--r--drivers/pci/hotplug/shpchp_hpc.c3
-rw-r--r--drivers/pci/pci.c13
9 files changed, 66 insertions, 30 deletions
diff --git a/drivers/pci/hotplug/acpi_pcihp.c b/drivers/pci/hotplug/acpi_pcihp.c
index a94d850ae228..2cac54802567 100644
--- a/drivers/pci/hotplug/acpi_pcihp.c
+++ b/drivers/pci/hotplug/acpi_pcihp.c
@@ -433,7 +433,8 @@ int acpi_pci_check_ejectable(struct pci_bus *pbus, acpi_handle handle)
433{ 433{
434 acpi_handle bridge_handle, parent_handle; 434 acpi_handle bridge_handle, parent_handle;
435 435
436 if (!(bridge_handle = acpi_pci_get_bridge_handle(pbus))) 436 bridge_handle = acpi_pci_get_bridge_handle(pbus);
437 if (!bridge_handle)
437 return 0; 438 return 0;
438 if ((ACPI_FAILURE(acpi_get_parent(handle, &parent_handle)))) 439 if ((ACPI_FAILURE(acpi_get_parent(handle, &parent_handle))))
439 return 0; 440 return 0;
diff --git a/drivers/pci/hotplug/cpci_hotplug_core.c b/drivers/pci/hotplug/cpci_hotplug_core.c
index 8359e29156ea..a5a7fd8332ac 100644
--- a/drivers/pci/hotplug/cpci_hotplug_core.c
+++ b/drivers/pci/hotplug/cpci_hotplug_core.c
@@ -125,7 +125,8 @@ disable_slot(struct hotplug_slot *hotplug_slot)
125 125
126 /* Unconfigure device */ 126 /* Unconfigure device */
127 dbg("%s - unconfiguring slot %s", __func__, slot_name(slot)); 127 dbg("%s - unconfiguring slot %s", __func__, slot_name(slot));
128 if ((retval = cpci_unconfigure_slot(slot))) { 128 retval = cpci_unconfigure_slot(slot);
129 if (retval) {
129 err("%s - could not unconfigure slot %s", 130 err("%s - could not unconfigure slot %s",
130 __func__, slot_name(slot)); 131 __func__, slot_name(slot));
131 goto disable_error; 132 goto disable_error;
@@ -141,9 +142,11 @@ disable_slot(struct hotplug_slot *hotplug_slot)
141 } 142 }
142 cpci_led_on(slot); 143 cpci_led_on(slot);
143 144
144 if (controller->ops->set_power) 145 if (controller->ops->set_power) {
145 if ((retval = controller->ops->set_power(slot, 0))) 146 retval = controller->ops->set_power(slot, 0);
147 if (retval)
146 goto disable_error; 148 goto disable_error;
149 }
147 150
148 if (update_adapter_status(slot->hotplug_slot, 0)) 151 if (update_adapter_status(slot->hotplug_slot, 0))
149 warn("failure to update adapter file"); 152 warn("failure to update adapter file");
diff --git a/drivers/pci/hotplug/cpcihp_zt5550.c b/drivers/pci/hotplug/cpcihp_zt5550.c
index cfd01e93e137..7ecf34e76a61 100644
--- a/drivers/pci/hotplug/cpcihp_zt5550.c
+++ b/drivers/pci/hotplug/cpcihp_zt5550.c
@@ -237,8 +237,9 @@ static int zt5550_hc_init_one (struct pci_dev *pdev, const struct pci_device_id
237 dbg("registered controller"); 237 dbg("registered controller");
238 238
239 /* Look for first device matching cPCI bus's bridge vendor and device IDs */ 239 /* Look for first device matching cPCI bus's bridge vendor and device IDs */
240 if (!(bus0_dev = pci_get_device(PCI_VENDOR_ID_DEC, 240 bus0_dev = pci_get_device(PCI_VENDOR_ID_DEC,
241 PCI_DEVICE_ID_DEC_21154, NULL))) { 241 PCI_DEVICE_ID_DEC_21154, NULL);
242 if (!bus0_dev) {
242 status = -ENODEV; 243 status = -ENODEV;
243 goto init_register_error; 244 goto init_register_error;
244 } 245 }
diff --git a/drivers/pci/hotplug/ibmphp_core.c b/drivers/pci/hotplug/ibmphp_core.c
index cfe2afe6e7aa..3efaf4c38528 100644
--- a/drivers/pci/hotplug/ibmphp_core.c
+++ b/drivers/pci/hotplug/ibmphp_core.c
@@ -1023,7 +1023,8 @@ static int enable_slot(struct hotplug_slot *hs)
1023 debug("ENABLING SLOT........\n"); 1023 debug("ENABLING SLOT........\n");
1024 slot_cur = hs->private; 1024 slot_cur = hs->private;
1025 1025
1026 if ((rc = validate(slot_cur, ENABLE))) { 1026 rc = validate(slot_cur, ENABLE);
1027 if (rc) {
1027 err("validate function failed\n"); 1028 err("validate function failed\n");
1028 goto error_nopower; 1029 goto error_nopower;
1029 } 1030 }
@@ -1335,17 +1336,20 @@ static int __init ibmphp_init(void)
1335 for (i = 0; i < 16; i++) 1336 for (i = 0; i < 16; i++)
1336 irqs[i] = 0; 1337 irqs[i] = 0;
1337 1338
1338 if ((rc = ibmphp_access_ebda())) 1339 rc = ibmphp_access_ebda();
1340 if (rc)
1339 goto error; 1341 goto error;
1340 debug("after ibmphp_access_ebda()\n"); 1342 debug("after ibmphp_access_ebda()\n");
1341 1343
1342 if ((rc = ibmphp_rsrc_init())) 1344 rc = ibmphp_rsrc_init();
1345 if (rc)
1343 goto error; 1346 goto error;
1344 debug("AFTER Resource & EBDA INITIALIZATIONS\n"); 1347 debug("AFTER Resource & EBDA INITIALIZATIONS\n");
1345 1348
1346 max_slots = get_max_slots(); 1349 max_slots = get_max_slots();
1347 1350
1348 if ((rc = ibmphp_register_pci())) 1351 rc = ibmphp_register_pci();
1352 if (rc)
1349 goto error; 1353 goto error;
1350 1354
1351 if (init_ops()) { 1355 if (init_ops()) {
@@ -1354,7 +1358,8 @@ static int __init ibmphp_init(void)
1354 } 1358 }
1355 1359
1356 ibmphp_print_test(); 1360 ibmphp_print_test();
1357 if ((rc = ibmphp_hpc_start_poll_thread())) 1361 rc = ibmphp_hpc_start_poll_thread();
1362 if (rc)
1358 goto error; 1363 goto error;
1359 1364
1360exit: 1365exit:
diff --git a/drivers/pci/hotplug/ibmphp_pci.c b/drivers/pci/hotplug/ibmphp_pci.c
index 2fd296706ce7..814cea22a9fa 100644
--- a/drivers/pci/hotplug/ibmphp_pci.c
+++ b/drivers/pci/hotplug/ibmphp_pci.c
@@ -145,7 +145,8 @@ int ibmphp_configure_card (struct pci_func *func, u8 slotno)
145 case PCI_HEADER_TYPE_NORMAL: 145 case PCI_HEADER_TYPE_NORMAL:
146 debug ("single device case.... vendor id = %x, hdr_type = %x, class = %x\n", vendor_id, hdr_type, class); 146 debug ("single device case.... vendor id = %x, hdr_type = %x, class = %x\n", vendor_id, hdr_type, class);
147 assign_alt_irq (cur_func, class_code); 147 assign_alt_irq (cur_func, class_code);
148 if ((rc = configure_device (cur_func)) < 0) { 148 rc = configure_device(cur_func);
149 if (rc < 0) {
149 /* We need to do this in case some other BARs were properly inserted */ 150 /* We need to do this in case some other BARs were properly inserted */
150 err ("was not able to configure devfunc %x on bus %x.\n", 151 err ("was not able to configure devfunc %x on bus %x.\n",
151 cur_func->device, cur_func->busno); 152 cur_func->device, cur_func->busno);
@@ -157,7 +158,8 @@ int ibmphp_configure_card (struct pci_func *func, u8 slotno)
157 break; 158 break;
158 case PCI_HEADER_TYPE_MULTIDEVICE: 159 case PCI_HEADER_TYPE_MULTIDEVICE:
159 assign_alt_irq (cur_func, class_code); 160 assign_alt_irq (cur_func, class_code);
160 if ((rc = configure_device (cur_func)) < 0) { 161 rc = configure_device(cur_func);
162 if (rc < 0) {
161 /* We need to do this in case some other BARs were properly inserted */ 163 /* We need to do this in case some other BARs were properly inserted */
162 err ("was not able to configure devfunc %x on bus %x...bailing out\n", 164 err ("was not able to configure devfunc %x on bus %x...bailing out\n",
163 cur_func->device, cur_func->busno); 165 cur_func->device, cur_func->busno);
diff --git a/drivers/pci/hotplug/ibmphp_res.c b/drivers/pci/hotplug/ibmphp_res.c
index 78cf442e36d6..2f2fcc8f7f8b 100644
--- a/drivers/pci/hotplug/ibmphp_res.c
+++ b/drivers/pci/hotplug/ibmphp_res.c
@@ -224,7 +224,8 @@ int __init ibmphp_rsrc_init (void)
224 if ((curr->rsrc_type & RESTYPE) == MMASK) { 224 if ((curr->rsrc_type & RESTYPE) == MMASK) {
225 /* no bus structure exists in place yet */ 225 /* no bus structure exists in place yet */
226 if (list_empty (&gbuses)) { 226 if (list_empty (&gbuses)) {
227 if ((rc = alloc_bus_range (&newbus, &newrange, curr, MEM, 1))) 227 rc = alloc_bus_range(&newbus, &newrange, curr, MEM, 1);
228 if (rc)
228 return rc; 229 return rc;
229 list_add_tail (&newbus->bus_list, &gbuses); 230 list_add_tail (&newbus->bus_list, &gbuses);
230 debug ("gbuses = NULL, Memory Primary Bus %x [%x - %x]\n", newbus->busno, newrange->start, newrange->end); 231 debug ("gbuses = NULL, Memory Primary Bus %x [%x - %x]\n", newbus->busno, newrange->start, newrange->end);
@@ -237,7 +238,8 @@ int __init ibmphp_rsrc_init (void)
237 return rc; 238 return rc;
238 } else { 239 } else {
239 /* went through all the buses and didn't find ours, need to create a new bus node */ 240 /* went through all the buses and didn't find ours, need to create a new bus node */
240 if ((rc = alloc_bus_range (&newbus, &newrange, curr, MEM, 1))) 241 rc = alloc_bus_range(&newbus, &newrange, curr, MEM, 1);