Skip to contentSkip to conversation

ACPI: FPDT: Add the missed acpi_put_table() in acpi_init_fpdt()

PATCH Applied Jing Xiangfeng 3 participants 3 messages Jun 2, 2021 – Jun 7, 2021 ACPI

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 ACPI: FPDT: Add 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")

---
v1 -> v2:
- Collect Acked-by tag by Zhang Rui.
- retitle the subject as suggested by Hanjun Guo.

---
 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
Reviewed-by on v2 1/1
#1 lore raw
Quoted 20 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")

---
v1 -> v2:
- Collect Acked-by tag by Zhang Rui.
- retitle the subject as suggested by Hanjun Guo.

---
  drivers/acpi/acpi_fpdt.c | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)
drivers/acpi/acpi_fpdt.c +0 -0
index a89a806a7a2a..4ee2ad234e3d 100644
@@ -240,8 +240,10 @@ static int __init acpi_init_fpdt(void)
  		return 0;

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

Quoted 10 lines
drivers/acpi/acpi_fpdt.c +3 -1
 
  	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;
maintainer Applied
#2 lore raw
In reply to Jing Xiangfeng
Quoted 22 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")

---
v1 -> v2:
- Collect Acked-by tag by Zhang Rui.
- retitle the subject as suggested by Hanjun Guo.

---
 drivers/acpi/acpi_fpdt.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/acpi/acpi_fpdt.c +0 -0
index a89a806a7a2a..4ee2ad234e3d 100644
@@ -240,8 +240,10 @@ static int __init acpi_init_fpdt(void)
                return 0;
 

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

Quoted 10 lines
drivers/acpi/acpi_fpdt.c +3 -2
        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;
--

Applied as 5.14 material with some edits in the subject and changelog, thanks!