Linux Power Management development
 help / color / mirror / Atom feed
From: Daniel Lezcano <daniel.lezcano@kernel.org>
To: rafael@kernel.org, daniel.lezcano@kernel.org
Cc: linux-pm@vger.kernel.org, rui.zhang@intel.com,
	lukasz.luba@arm.com, linux-kernel@vger.kernel.org
Subject: [PATCH] thermal/core: Fix double device initialization
Date: Mon, 25 May 2026 17:16:10 +0200	[thread overview]
Message-ID: <20260525151609.2826121-2-daniel.lezcano@kernel.org> (raw)

In the previous change splitting the cooling device register function,
the device initialization was mistakenly added in the move.

This change is wrong because the device is registered with the
function device_register() which does device_initialize() and then
device_add(). That results in a double initialization and a message in
logs:

[    1.531290] kobject: kobject (0000000053ba73b2): tried to init an initialized object, something is seriously wrong.
[    1.531293] CPU: 9 UID: 0 PID: 420 Comm: kworker/u50:3 Not tainted 7.1.0-rc1+ #48 PREEMPT(lazy)
[    1.531294] Hardware name: LENOVO 21N10007UK/21N10007UK, BIOS N42ET38W (1.12 ) 05/29/2024
[    1.531295] Workqueue: events_unbound deferred_probe_work_func
[    1.531298] Call trace:
[    1.531298]  show_stack+0x24/0x50 (C)
[    1.531301]  dump_stack_lvl+0x80/0xc0
[    1.531303]  kobject_init+0xc0/0xd8
[    1.531305]  device_initialize+0x3c/0x140
[    1.531308]  device_register+0x20/0x48
[    1.531310]  thermal_cooling_device_add+0xe0/0x208
[    1.531311]  thermal_of_cooling_device_register+0x54/0xa0
[    1.531313]  __cpufreq_cooling_register+0x1e0/0x368
[    1.531315]  of_cpufreq_cooling_register+0x64/0xe0
[    1.531316]  cpufreq_online+0xa6c/0xef0
[    1.531317]  cpufreq_add_dev+0x108/0x180
[    1.531318]  subsys_interface_register+0x138/0x168
[    1.531320]  cpufreq_register_driver+0x1b8/0x390

Fix by just removing the added line.

Fixes: 13f4e660a126 ("thermal/core: Split __thermal_cooling_device_register() into two functions")
Signed-off-by: Daniel Lezcano <daniel.lezcano@kernel.org>
---
 drivers/thermal/thermal_core.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
index 9b9fa51067bd..3cf305ceaf41 100644
--- a/drivers/thermal/thermal_core.c
+++ b/drivers/thermal/thermal_core.c
@@ -1012,7 +1012,6 @@ static int thermal_cooling_device_add(struct thermal_cooling_device *cdev, void
 	cdev->updated = false;
 	cdev->device.class = thermal_class;
 	cdev->device.release = thermal_cdev_release;
-	device_initialize(&cdev->device);
 	cdev->devdata = devdata;
 
 	ret = dev_set_name(&cdev->device, "cooling_device%d", cdev->id);
-- 
2.43.0


             reply	other threads:[~2026-05-25 15:16 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-25 15:16 Daniel Lezcano [this message]
2026-05-25 15:29 ` [PATCH] thermal/core: Fix double device initialization Rafael J. Wysocki
2026-05-25 15:33   ` Rafael J. Wysocki
2026-05-25 15:43   ` Daniel Lezcano
2026-05-31  9:42 ` kernel test robot

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=20260525151609.2826121-2-daniel.lezcano@kernel.org \
    --to=daniel.lezcano@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=lukasz.luba@arm.com \
    --cc=rafael@kernel.org \
    --cc=rui.zhang@intel.com \
    /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