[PATCH 3/3] IDE-ACPI: Move an assignment for one variable in ide_get_dev_handle()

SF Markus Elfring
2015-12-26T10:20:10Z

Date: Sat, 26 Dec 2015 10:50:33 +0100

Move the assignment for the variable "addr" to the statement
where its value is used after previous function calls succeeded.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/ide/ide-acpi.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/ide/ide-acpi.c b/drivers/ide/ide-acpi.c
index b6b2111..c2de9f9 100644
--- a/drivers/ide/ide-acpi.c
+++ b/drivers/ide/ide-acpi.c
@@ -132,9 +132,6 @@ static int ide_get_dev_handle(struct device *dev, acpi_handle *handle,
bus = pdev->bus->number;
devnum = PCI_SLOT(pdev->devfn);
func = PCI_FUNC(pdev->devfn);
- /* ACPI _ADR encoding for PCI bus: */
- addr = (u64)(devnum << 16 | func);
-
DEBPRINT("ENTER: pci %02x:%02x.%01x\n", bus, devnum, func);

dev_handle = ACPI_HANDLE(dev);
@@ -148,6 +145,8 @@ static int ide_get_dev_handle(struct device *dev, acpi_handle *handle,
DEBPRINT("get_object_info for device failed\n");
return -ENODEV;
}
+ /* ACPI _ADR encoding for PCI bus: */
+ addr = (u64)(devnum << 16 | func);
if ((dinfo->valid & ACPI_VALID_ADR) &&
dinfo->address = addr) {
*pcidevfn = addr;
--
2.6.3