ACPI: bus: Remove the not needed NULL set
PATCH 1/2 ACPI: bus: Remove the not needed NULL set
Code running with if (!acpi_kobj) is true, acpi_kobj is NULL as it is, no need to set to NULL.
Signed-off-by Hanjun Guo <[email protected]>
--- drivers/acpi/bus.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/acpi/bus.c +1 -3
@@ -1325,10 +1325,8 @@ static int __init acpi_init(void) } acpi_kobj =kobject_create_and_add ("acpi" , firmware_kobj); -if (!acpi_kobj) { +if (!acpi_kobj)pr_debug ("%s: kset create error\n" , __func__); - acpi_kobj =NULL ; - } result =acpi_bus_init ();if (result) {
Signature · 1 line
1.7.12.4
PATCH 2/2 ACPI: bus: Call kobject_put() in error path for acpi_init()
Although the system will not in good condition or boot failed if acpi_bus_init() failed, we still need to put the kobject in error patch before return, to make the code right.
Signed-off-by Hanjun Guo <[email protected]>
--- drivers/acpi/bus.c | 1 + 1 file changed, 1 insertion(+)
drivers/acpi/bus.c +1 -0
@@ -1330,6 +1330,7 @@ static int __init acpi_init(void) result =acpi_bus_init ();if (result) { +kobject_put (acpi_kobj);disable_acpi ();return result; }
Signature · 1 line
1.7.12.4
Quoted 16 lines · Hanjun Guo
Code running with if (!acpi_kobj) is true,
acpi_kobjis NULL as it is, no need to set to NULL.Signed-off-by Hanjun Guo <[email protected]>--- drivers/acpi/bus.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)drivers/acpi/bus.c +0
-0@@ -1325,10 +1325,8 @@ static int __init acpi_init(void) }
drivers/acpi/bus.c static int __init acpi_init(void)
Quoted 10 lines
drivers/acpi/bus.c +1
-4acpi_kobj =kobject_create_and_add ("acpi" , firmware_kobj); -if (!acpi_kobj) { +if (!acpi_kobj)pr_debug ("%s: kset create error\n" , __func__); - acpi_kobj =NULL ; - } result =acpi_bus_init ();if (result) { --
Applied as 5.14 material along with the [2/2[ with some edits in the subject and changelog, thanks!