Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 79e50e72 authored by Quentin Lambert's avatar Quentin Lambert Committed by Bjorn Helgaas
Browse files

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: default avatarQuentin Lambert <lambert.quentin@gmail.com>
Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
parent 656f978f
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -433,7 +433,8 @@ int acpi_pci_check_ejectable(struct pci_bus *pbus, acpi_handle handle)
{
	acpi_handle bridge_handle, parent_handle;

	if (!(bridge_handle = acpi_pci_get_bridge_handle(pbus)))
	bridge_handle = acpi_pci_get_bridge_handle(pbus);
	if (!bridge_handle)
		return 0;
	if ((ACPI_FAILURE(acpi_get_parent(handle, &parent_handle))))
		return 0;
+6 −3
Original line number Diff line number Diff line
@@ -125,7 +125,8 @@ disable_slot(struct hotplug_slot *hotplug_slot)

	/* Unconfigure device */
	dbg("%s - unconfiguring slot %s", __func__, slot_name(slot));
	if ((retval = cpci_unconfigure_slot(slot))) {
	retval = cpci_unconfigure_slot(slot);
	if (retval) {
		err("%s - could not unconfigure slot %s",
		    __func__, slot_name(slot));
		goto disable_error;
@@ -141,9 +142,11 @@ disable_slot(struct hotplug_slot *hotplug_slot)
	}
	cpci_led_on(slot);

	if (controller->ops->set_power)
		if ((retval = controller->ops->set_power(slot, 0)))
	if (controller->ops->set_power) {
		retval = controller->ops->set_power(slot, 0);
		if (retval)
			goto disable_error;
	}

	if (update_adapter_status(slot->hotplug_slot, 0))
		warn("failure to update adapter file");
+3 −2
Original line number Diff line number Diff line
@@ -237,8 +237,9 @@ static int zt5550_hc_init_one (struct pci_dev *pdev, const struct pci_device_id
	dbg("registered controller");

	/* Look for first device matching cPCI bus's bridge vendor and device IDs */
	if (!(bus0_dev = pci_get_device(PCI_VENDOR_ID_DEC,
					 PCI_DEVICE_ID_DEC_21154, NULL))) {
	bus0_dev = pci_get_device(PCI_VENDOR_ID_DEC,
				  PCI_DEVICE_ID_DEC_21154, NULL);
	if (!bus0_dev) {
		status = -ENODEV;
		goto init_register_error;
	}
+10 −5
Original line number Diff line number Diff line
@@ -1023,7 +1023,8 @@ static int enable_slot(struct hotplug_slot *hs)
	debug("ENABLING SLOT........\n");
	slot_cur = hs->private;

	if ((rc = validate(slot_cur, ENABLE))) {
	rc = validate(slot_cur, ENABLE);
	if (rc) {
		err("validate function failed\n");
		goto error_nopower;
	}
@@ -1335,17 +1336,20 @@ static int __init ibmphp_init(void)
	for (i = 0; i < 16; i++)
		irqs[i] = 0;

	if ((rc = ibmphp_access_ebda()))
	rc = ibmphp_access_ebda();
	if (rc)
		goto error;
	debug("after ibmphp_access_ebda()\n");

	if ((rc = ibmphp_rsrc_init()))
	rc = ibmphp_rsrc_init();
	if (rc)
		goto error;
	debug("AFTER Resource & EBDA INITIALIZATIONS\n");

	max_slots = get_max_slots();

	if ((rc = ibmphp_register_pci()))
	rc = ibmphp_register_pci();
	if (rc)
		goto error;

	if (init_ops()) {
@@ -1354,7 +1358,8 @@ static int __init ibmphp_init(void)
	}

	ibmphp_print_test();
	if ((rc = ibmphp_hpc_start_poll_thread()))
	rc = ibmphp_hpc_start_poll_thread();
	if (rc)
		goto error;

exit:
+4 −2
Original line number Diff line number Diff line
@@ -145,7 +145,8 @@ int ibmphp_configure_card (struct pci_func *func, u8 slotno)
				case PCI_HEADER_TYPE_NORMAL:
					debug ("single device case.... vendor id = %x, hdr_type = %x, class = %x\n", vendor_id, hdr_type, class);
					assign_alt_irq (cur_func, class_code);
					if ((rc = configure_device (cur_func)) < 0) {
					rc = configure_device(cur_func);
					if (rc < 0) {
						/* We need to do this in case some other BARs were properly inserted */
						err ("was not able to configure devfunc %x on bus %x.\n",
						     cur_func->device, cur_func->busno);
@@ -157,7 +158,8 @@ int ibmphp_configure_card (struct pci_func *func, u8 slotno)
					break;
				case PCI_HEADER_TYPE_MULTIDEVICE:
					assign_alt_irq (cur_func, class_code);
					if ((rc = configure_device (cur_func)) < 0) {
					rc = configure_device(cur_func);
					if (rc < 0) {
						/* We need to do this in case some other BARs were properly inserted */
						err ("was not able to configure devfunc %x on bus %x...bailing out\n",
						     cur_func->device, cur_func->busno);
Loading