linux-yocto/drivers/powercap
Sumeet Pawnikar 9e2fcfc324 powercap: fix sscanf() error return value handling
[ Upstream commit efc4c35b741af973de90f6826bf35d3b3ac36bf1 ]

Fix inconsistent error handling for sscanf() return value check.

Implicit boolean conversion is used instead of explicit return
value checks. The code checks if (!sscanf(...)) which is incorrect
because:
 1. sscanf returns the number of successfully parsed items
 2. On success, it returns 1 (one item passed)
 3. On failure, it returns 0 or EOF
 4. The check 'if (!sscanf(...))' is wrong because it treats
    success (1) as failure

All occurrences of sscanf() now uses explicit return value check.
With this behavior it returns '-EINVAL' when parsing fails (returns
0 or EOF), and continues when parsing succeeds (returns 1).

Signed-off-by: Sumeet Pawnikar <sumeet4linux@gmail.com>
[ rjw: Subject and changelog edits ]
Link: https://patch.msgid.link/20251207151549.202452-1-sumeet4linux@gmail.com
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2026-01-17 16:35:32 +01:00
..
arm_scmi_powercap.c powercap: arm_scmi: Remove recursion while parsing zones 2023-07-20 20:27:10 +02:00
dtpm_cpu.c powercap: dtpm_cpu: Fix NULL pointer dereference in get_pd_power_uw() 2025-07-03 17:19:37 +02:00
dtpm_devfreq.c powercap: dtpm_devfreq: Fix error check against dev_pm_qos_add_request() 2024-10-21 13:23:06 +02:00
dtpm_subsys.h powercap/drivers/dtpm: Add dtpm devfreq with energy model support 2022-02-04 17:38:09 +01:00
dtpm.c powercap: dtpm: Fix kernel-doc for dtpm_create_hierarchy() function 2024-03-01 21:39:10 +01:00
idle_inject.c powercap: idle_inject: use us_to_ktime() where appropriate 2025-08-21 21:57:54 +02:00
intel_rapl_common.c powercap: intel_rapl: Add support for Nova Lake processors 2026-01-08 10:17:21 +01:00
intel_rapl_msr.c powercap: intel_rapl: Add support for Nova Lake processors 2026-01-08 10:17:21 +01:00
intel_rapl_tpmi.c platform/x86/intel/tpmi: Relocate platform info to intel_vsec.h 2025-07-03 11:09:35 +03:00
Kconfig PM: EM: Rework the depends on for CONFIG_ENERGY_MODEL 2025-03-07 15:23:46 +01:00
Makefile powercap: intel_rapl: Introduce RAPL TPMI interface driver 2023-05-24 18:46:20 +02:00
powercap_sys.c powercap: fix sscanf() error return value handling 2026-01-17 16:35:32 +01:00