mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Armin Wolf <W_Armin@gmx.de>
To: rafael@kernel.org, lenb@kernel.org
Cc: j@jannau.net, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 2/2] ACPI: bus: Bail out if acpi_kobj registration fails
Date: Sun, 18 May 2025 20:51:11 +0200	[thread overview]
Message-ID: <20250518185111.3560-2-W_Armin@gmx.de> (raw)
In-Reply-To: <20250518185111.3560-1-W_Armin@gmx.de>

The ACPI sysfs code will fail to initialize if acpi_kobj is NULL,
together with some ACPI drivers. Follow the other firmware subsystems
and bail out if the kobject cannot be registered.

Signed-off-by: Armin Wolf <W_Armin@gmx.de>
---
 drivers/acpi/bus.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c
index 058910af82bc..c2ab2783303f 100644
--- a/drivers/acpi/bus.c
+++ b/drivers/acpi/bus.c
@@ -1446,8 +1446,10 @@ static int __init acpi_init(void)
 	}
 
 	acpi_kobj = kobject_create_and_add("acpi", firmware_kobj);
-	if (!acpi_kobj)
-		pr_debug("%s: kset create error\n", __func__);
+	if (!acpi_kobj) {
+		pr_err("Failed to register kobject\n");
+		return -ENOMEM;
+	}
 
 	init_prmt();
 	acpi_init_pcc();
-- 
2.39.5


  reply	other threads:[~2025-05-18 18:51 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-18 18:51 [PATCH 1/2] ACPI: platform_profile: Add support for non-ACPI platforms Armin Wolf
2025-05-18 18:51 ` Armin Wolf [this message]
2025-05-23 14:56   ` [PATCH 2/2] ACPI: bus: Bail out if acpi_kobj registration fails Rafael J. Wysocki
2025-05-21 20:17 ` [PATCH 1/2] ACPI: platform_profile: Add support for non-ACPI platforms Rafael J. Wysocki
2025-05-22  4:34   ` Armin Wolf
2025-05-23 14:39     ` Rafael J. Wysocki
2025-05-23 16:29       ` Janne Grunau
2025-05-23 18:02         ` Rafael J. Wysocki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250518185111.3560-2-W_Armin@gmx.de \
    --to=w_armin@gmx.de \
    --cc=j@jannau.net \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rafael@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®