linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] ACPI: bus: Remove the not needed NULL set
@ 2021-06-02  9:36 Hanjun Guo
  2021-06-02  9:36 ` [PATCH 2/2] ACPI: bus: Call kobject_put() in error path for acpi_init() Hanjun Guo
  2021-06-07 13:46 ` [PATCH 1/2] ACPI: bus: Remove the not needed NULL set Rafael J. Wysocki
  0 siblings, 2 replies; 3+ messages in thread
From: Hanjun Guo @ 2021-06-02  9:36 UTC (permalink / raw)
  To: linux-acpi; +Cc: Rafael J. Wysocki, Hanjun Guo

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 <guohanjun@huawei.com>
---
 drivers/acpi/bus.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c
index 60787d9..f9b5262 100644
--- a/drivers/acpi/bus.c
+++ b/drivers/acpi/bus.c
@@ -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) {
-- 
1.7.12.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] ACPI: bus: Call kobject_put() in error path for acpi_init()
  2021-06-02  9:36 [PATCH 1/2] ACPI: bus: Remove the not needed NULL set Hanjun Guo
@ 2021-06-02  9:36 ` Hanjun Guo
  2021-06-07 13:46 ` [PATCH 1/2] ACPI: bus: Remove the not needed NULL set Rafael J. Wysocki
  1 sibling, 0 replies; 3+ messages in thread
From: Hanjun Guo @ 2021-06-02  9:36 UTC (permalink / raw)
  To: linux-acpi; +Cc: Rafael J. Wysocki, Hanjun Guo

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 <guohanjun@huawei.com>
---
 drivers/acpi/bus.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c
index f9b5262..008ae29 100644
--- a/drivers/acpi/bus.c
+++ b/drivers/acpi/bus.c
@@ -1330,6 +1330,7 @@ static int __init acpi_init(void)
 
 	result = acpi_bus_init();
 	if (result) {
+		kobject_put(acpi_kobj);
 		disable_acpi();
 		return result;
 	}
-- 
1.7.12.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/2] ACPI: bus: Remove the not needed NULL set
  2021-06-02  9:36 [PATCH 1/2] ACPI: bus: Remove the not needed NULL set Hanjun Guo
  2021-06-02  9:36 ` [PATCH 2/2] ACPI: bus: Call kobject_put() in error path for acpi_init() Hanjun Guo
@ 2021-06-07 13:46 ` Rafael J. Wysocki
  1 sibling, 0 replies; 3+ messages in thread
From: Rafael J. Wysocki @ 2021-06-07 13:46 UTC (permalink / raw)
  To: Hanjun Guo; +Cc: ACPI Devel Maling List, Rafael J. Wysocki

On Wed, Jun 2, 2021 at 11:47 AM Hanjun Guo <guohanjun@huawei.com> wrote:
>
> 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 <guohanjun@huawei.com>
> ---
>  drivers/acpi/bus.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c
> index 60787d9..f9b5262 100644
> --- a/drivers/acpi/bus.c
> +++ b/drivers/acpi/bus.c
> @@ -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) {
> --

Applied as 5.14 material along with the [2/2[ with some edits in the
subject and changelog, thanks!

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-06-07 13:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-02  9:36 [PATCH 1/2] ACPI: bus: Remove the not needed NULL set Hanjun Guo
2021-06-02  9:36 ` [PATCH 2/2] ACPI: bus: Call kobject_put() in error path for acpi_init() Hanjun Guo
2021-06-07 13:46 ` [PATCH 1/2] ACPI: bus: Remove the not needed NULL set Rafael J. Wysocki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).