[PATCH] ibft: Put ibft_addr back

From: Konrad Rzeszutek Wilk
Date: Tue Feb 02 2021 - 12:28:28 EST


Signed-off-by: Konrad Rzeszutek Wilk <konrad@xxxxxxxxxx>
---
drivers/firmware/iscsi_ibft.c | 19 +++++++++++++------
1 file changed, 13 insertions(+), 6 deletions(-)

diff --git a/drivers/firmware/iscsi_ibft.c b/drivers/firmware/iscsi_ibft.c
index 7127a04..2a1a033 100644
--- a/drivers/firmware/iscsi_ibft.c
+++ b/drivers/firmware/iscsi_ibft.c
@@ -811,6 +811,10 @@ static void ibft_cleanup(void)
ibft_unregister();
iscsi_boot_destroy_kset(boot_kset);
}
+ if (ibft_addr) {
+ acpi_put_table((struct acpi_table_header *)ibft_addr);
+ ibft_addr = NULL;
+ }
}

static void __exit ibft_exit(void)
@@ -835,13 +839,15 @@ static void __init acpi_find_ibft_region(void)
{
int i;
struct acpi_table_header *table = NULL;
+ acpi_status status;

if (acpi_disabled)
return;

for (i = 0; i < ARRAY_SIZE(ibft_signs) && !ibft_addr; i++) {
- acpi_get_table(ibft_signs[i].sign, 0, &table);
- ibft_addr = (struct acpi_table_ibft *)table;
+ status = acpi_get_table(ibft_signs[i].sign, 0, &table);
+ if (ACPI_SUCCESS(status))
+ ibft_addr = (struct acpi_table_ibft *)table;
}
}
#else
@@ -870,12 +876,13 @@ static int __init ibft_init(void)

rc = ibft_check_device();
if (rc)
- return rc;
+ goto out_free;

boot_kset = iscsi_boot_create_kset("ibft");
- if (!boot_kset)
- return -ENOMEM;
-
+ if (!boot_kset) {
+ rc = -ENOMEM;
+ goto out_free;
+ }
/* Scan the IBFT for data and register the kobjects. */
rc = ibft_register_kobjects(ibft_addr);
if (rc)
--
1.8.3.1