linux-yocto/drivers/powercap
Joe Hattori e4beb8aa35 powercap: call put_device() on an error path in powercap_register_control_type()
[ Upstream commit 93c66fbc28 ]

powercap_register_control_type() calls device_register(), but does not
release the refcount of the device when it fails.

Call put_device() before returning an error to balance the refcount.

Since the kfree(control_type) will be done by powercap_release(), remove
the lines in powercap_register_control_type() before returning the error.

This bug was found by an experimental verifier that I am developing.

Signed-off-by: Joe Hattori <joe@pf.is.s.u-tokyo.ac.jp>
Link: https://patch.msgid.link/20250110010554.1583411-1-joe@pf.is.s.u-tokyo.ac.jp
[ rjw: Changelog edits ]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2025-03-28 21:58:50 +01:00
..
dtpm_cpu.c powercap: dtpm_cpu: Fix error check against freq_qos_add_request() 2024-03-26 18:20:36 -04:00
dtpm_devfreq.c powercap: dtpm_devfreq: Fix error check against dev_pm_qos_add_request() 2024-11-01 01:56:05 +01:00
dtpm_subsys.h
dtpm.c
idle_inject.c
intel_rapl_common.c
intel_rapl_msr.c powercap: RAPL: fix invalid initialization for pl4_supported field 2024-09-30 16:23:56 +02:00
Kconfig
Makefile
powercap_sys.c powercap: call put_device() on an error path in powercap_register_control_type() 2025-03-28 21:58:50 +01:00