Skip to contentSkip to conversation

ACPI: tables: fixes the missed acpi_put_table() in acpi_init_fpdt()

PATCH Superseded Jing Xiangfeng 3 participants 4 messages Jun 2, 2021 ACPI

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ACPI: tables: fixes the missed acpi_put_table() in acpi_init_fpdt()

acpi_init_fpdt() misses to call acpi_put_table() in an error path. Add the missed function call to fix it.

Fixes d1eb86e59be0 ("ACPI: tables: introduce support for FPDT table")
---
 drivers/acpi/acpi_fpdt.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/acpi/acpi_fpdt.c +3 -1
index a89a806a7a2a..4ee2ad234e3d 100644
@@ -240,8 +240,10 @@ static int __init acpi_init_fpdt(void)
 		return 0;
 
 	fpdt_kobj = kobject_create_and_add("fpdt", acpi_kobj);
-	if (!fpdt_kobj)
+	if (!fpdt_kobj) {
+		acpi_put_table(header);
 		return -ENOMEM;
+	}
 
 	while (offset < header->length) {
 		subtable = (void *)header + offset;
Signature · 1 line
2.26.0.106.g9fadedd
Acked-by on v1 1/1
#1 lore raw

Hi, Xiangfeng,

thanks for the patch.

Quoted 7 lines · Jing Xiangfeng

acpi_init_fpdt() misses to call acpi_put_table() in an error path. Add
the missed function call to fix it.

Fixes d1eb86e59be0 ("ACPI: tables: introduce support for FPDT

table")

thanks,
rui

Quoted 20 lines
---
 drivers/acpi/acpi_fpdt.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/acpi/acpi_fpdt.c +3 -1
index a89a806a7a2a..4ee2ad234e3d 100644
@@ -240,8 +240,10 @@ static int __init acpi_init_fpdt(void)
 		return 0;
 
 	fpdt_kobj = kobject_create_and_add("fpdt", acpi_kobj);
-	if (!fpdt_kobj)
+	if (!fpdt_kobj) {
+		acpi_put_table(header);
 		return -ENOMEM;
+	}
 
 	while (offset < header->length) {
 		subtable = (void *)header + offset;
#2 lore raw
In reply to Jing Xiangfeng

The title of this patch is misleading, how about "ACPI: FPDT: Add the missed acpi_put_table() in acpi_init_fpdt()" ?

Quoted 14 lines · Jing Xiangfeng

acpi_init_fpdt() misses to call acpi_put_table() in an error path. Add the missed function call to fix it.

Fixes d1eb86e59be0 ("ACPI: tables: introduce support for FPDT table")
---
  drivers/acpi/acpi_fpdt.c | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)
drivers/acpi/acpi_fpdt.c +0 -0
index a89a806a7a2a..4ee2ad234e3d 100644

drivers/acpi/acpi_fpdt.c static int __init acpi_init_fpdt(void) · line 246

Quoted 8 lines
drivers/acpi/acpi_fpdt.c +3 -1
@@ -240,8 +240,10 @@ static int __init acpi_init_fpdt(void)
  		return 0;
 
  	fpdt_kobj = kobject_create_and_add("fpdt", acpi_kobj);
-	if (!fpdt_kobj)
+	if (!fpdt_kobj) {
+		acpi_put_table(header);
  		return -ENOMEM;
+	}

The code looks good to me.

Thanks
Hanjun

#3 lore raw
Quoted 2 lines · Hanjun Guo

The title of this patch is misleading, how about "ACPI: FPDT: Add the missed acpi_put_table() in acpi_init_fpdt()" ?

Thanks a lot for your comments! I'll send a v2 with this change.

Quoted 30 lines · Jing Xiangfeng
Quoted 14 lines

acpi_init_fpdt() misses to call acpi_put_table() in an error path. Add the missed function call to fix it.

Fixes d1eb86e59be0 ("ACPI: tables: introduce support for FPDT table")
---
  drivers/acpi/acpi_fpdt.c | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)
drivers/acpi/acpi_fpdt.c +0 -0
index a89a806a7a2a..4ee2ad234e3d 100644

drivers/acpi/acpi_fpdt.c static int __init acpi_init_fpdt(void) · line 245

Quoted 7 lines
drivers/acpi/acpi_fpdt.c +3 -1
@@ -240,8 +240,10 @@ static int __init acpi_init_fpdt(void)
          return 0;
        fpdt_kobj = kobject_create_and_add("fpdt", acpi_kobj);
-    if (!fpdt_kobj)
+    if (!fpdt_kobj) {
+        acpi_put_table(header);
          return -ENOMEM;
+    }

The code looks good to me.

Thanks
Hanjun
.