diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2016-11-22 22:15:59 +0100 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2016-11-24 21:58:31 +0100 |
commit | a74f43675790ae55b908940652b4b04b236d8f18 (patch) | |
tree | d189b5b172644d771f5053c36a2dae80e84f5a7b /drivers/powercap/intel_rapl.c | |
parent | powercap/intel_rapl: Add missing domain data update on hotplug (diff) | |
download | linux-a74f43675790ae55b908940652b4b04b236d8f18.tar.xz linux-a74f43675790ae55b908940652b4b04b236d8f18.zip |
powercap/intel_rapl: Propagate error code when registration fails
If rapl_package_register_powercap() fails in rapl_add_package() the
function happily returns 0.
Capture the error code and propagate it.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Tested-by: Jacob Pan <jacob.jun.pan@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/powercap/intel_rapl.c')
-rw-r--r-- | drivers/powercap/intel_rapl.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/powercap/intel_rapl.c b/drivers/powercap/intel_rapl.c index 94b9901d192f..79b1e041f2ec 100644 --- a/drivers/powercap/intel_rapl.c +++ b/drivers/powercap/intel_rapl.c @@ -1563,9 +1563,8 @@ static void rapl_remove_package(struct rapl_package *rp) /* called from CPU hotplug notifier, hotplug lock held */ static int rapl_add_package(int cpu) { - int ret = 0; - int phy_package_id; struct rapl_package *rp; + int ret, phy_package_id; phy_package_id = topology_physical_package_id(cpu); rp = kzalloc(sizeof(struct rapl_package), GFP_KERNEL); @@ -1583,10 +1582,11 @@ static int rapl_add_package(int cpu) ret = -ENODEV; goto err_free_package; } - if (!rapl_package_register_powercap(rp)) { + ret = rapl_package_register_powercap(rp); + if (!ret) { INIT_LIST_HEAD(&rp->plist); list_add(&rp->plist, &rapl_packages); - return ret; + return 0; } err_free_package: |