diff mbox series

[v2] ACPI: FPDT: Add the missed acpi_put_table() in acpi_init_fpdt()

Message ID 20210602115812.109900-1-jingxiangfeng@huawei.com
State Accepted
Commit dd9eaa23e72572d4f1c03f2e5d2e14a5b5793e79
Headers show
Series [v2] ACPI: FPDT: Add the missed acpi_put_table() in acpi_init_fpdt() | expand

Commit Message

Jing Xiangfeng June 2, 2021, 11:58 a.m. UTC
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")
Signed-off-by: Jing Xiangfeng <jingxiangfeng@huawei.com>
Acked-by: Zhang Rui <rui.zhang@intel.com>
---
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(-)

Comments

Hanjun Guo June 3, 2021, 1:02 a.m. UTC | #1
On 2021/6/2 19:58, Jing Xiangfeng wrote:
> 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")

> Signed-off-by: Jing Xiangfeng <jingxiangfeng@huawei.com>

> Acked-by: Zhang Rui <rui.zhang@intel.com>

> ---

> 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(-)

> 

> diff --git a/drivers/acpi/acpi_fpdt.c b/drivers/acpi/acpi_fpdt.c

> index a89a806a7a2a..4ee2ad234e3d 100644

> --- a/drivers/acpi/acpi_fpdt.c

> +++ b/drivers/acpi/acpi_fpdt.c

> @@ -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;


Reviewed-by: Hanjun Guo <guohanjun@huawei.com>
Rafael J. Wysocki June 7, 2021, 1:59 p.m. UTC | #2
On Wed, Jun 2, 2021 at 1:44 PM Jing Xiangfeng <jingxiangfeng@huawei.com> wrote:
>

> 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")

> Signed-off-by: Jing Xiangfeng <jingxiangfeng@huawei.com>

> Acked-by: Zhang Rui <rui.zhang@intel.com>

> ---

> 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(-)

>

> diff --git a/drivers/acpi/acpi_fpdt.c b/drivers/acpi/acpi_fpdt.c

> index a89a806a7a2a..4ee2ad234e3d 100644

> --- a/drivers/acpi/acpi_fpdt.c

> +++ b/drivers/acpi/acpi_fpdt.c

> @@ -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;

> --


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

Patch

diff --git a/drivers/acpi/acpi_fpdt.c b/drivers/acpi/acpi_fpdt.c
index a89a806a7a2a..4ee2ad234e3d 100644
--- a/drivers/acpi/acpi_fpdt.c
+++ b/drivers/acpi/acpi_fpdt.c
@@ -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;