linux-stable/tools/power
Hao Zeng a62d40c1de cpupower:Fix resource leaks in sysfs_get_enabled()
[ Upstream commit e652be0f59 ]

The sysfs_get_enabled() opened file processor not closed,
may cause a file handle leak.
Putting error handling and resource cleanup code together
makes the code easy to maintain and read.
Removed the unnecessary else if branch from the original
function, as it should return an error in cases other than '0'.

Signed-off-by: Hao Zeng <zenghao@kylinos.cn>
Suggested-by: Shuah Khan <skhan@linuxfoundation.org>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-06-09 10:48:02 +02:00
..
acpi ACPI: tools: pfrut: Check if the input of level and type is in the right numeric range 2023-03-14 20:38:13 +01:00
cpupower cpupower:Fix resource leaks in sysfs_get_enabled() 2023-06-09 10:48:02 +02:00
pm-graph pm-graph: sleepgraph: Avoid crashing on binary data in device names 2023-03-14 18:51:59 +01:00
x86 tools/power turbostat: version 2023.03.17 2023-03-17 11:36:46 -04:00