android_kernel_motorola_sm6375/drivers/powercap
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Joe Hattori 6752747a11 powercap: call put_device() on an error path in powercap_register_control_type()
[ Upstream commit 93c66fbc280747ea700bd6199633d661e3c819b3 ]

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 <[email protected]>
Link: https://patch.msgid.link/[email protected]
[ rjw: Changelog edits ]
Signed-off-by: Rafael J. Wysocki <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
2025-04-10 14:29:36 +02:00
..
idle_inject.c
intel_rapl_common.c
intel_rapl_msr.c powercap: RAPL: Fix CONFIG_IOSF_MBI dependency 2023-07-27 08:37:06 +02:00
Kconfig powercap: RAPL: Fix CONFIG_IOSF_MBI dependency 2023-07-27 08:37:06 +02:00
Makefile
powercap_sys.c powercap: call put_device() on an error path in powercap_register_control_type() 2025-04-10 14:29:36 +02:00