Skip to content
Snippets Groups Projects
Commit e652be0f authored by Hao Zeng's avatar Hao Zeng Committed by Shuah Khan
Browse files

cpupower:Fix resource leaks in sysfs_get_enabled()


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: default avatarHao Zeng <zenghao@kylinos.cn>
Suggested-by: default avatarShuah Khan <skhan@linuxfoundation.org>
Signed-off-by: default avatarShuah Khan <skhan@linuxfoundation.org>
parent ac9a7868
No related branches found
No related tags found
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment