Skip to content
Commit 1b6599f7 authored by Yang Yingliang's avatar Yang Yingliang Committed by Rafael J. Wysocki
Browse files

powercap: fix possible name leak in powercap_register_zone()



In the error path after calling dev_set_name(), the device
name is leaked. To fix this, calling dev_set_name() before
device_register(), and call put_device() if it returns error.

All the resources is released in powercap_release(), so it
can return from powercap_register_zone() directly.

Fixes: 75d2364e ("PowerCap: Add class driver")
Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent 5dc4c995
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment