diff mbox series

[2/2] ACPI: bus: Call kobject_put() in error path for acpi_init()

Message ID 1622626610-58140-2-git-send-email-guohanjun@huawei.com (mailing list archive)
State Mainlined, archived
Headers show
Series [1/2] ACPI: bus: Remove the not needed NULL set | expand

Commit Message

Hanjun Guo June 2, 2021, 9:36 a.m. UTC
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 mbox series

Patch

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