Skip to content

Commit f2a6c7e

Browse files
Dan Carpenterjwrdegoede
authored andcommitted
platform/x86: intel-uncore-freq: fix uncore_freq_common_init() error codes
Currently the uncore_freq_common_init() return one on success and zero on failure. There is only one caller and it has a "forgot to set the error code" bug. Change uncore_freq_common_init() to return negative error codes which makes the code simpler and avoids this kind of bug in the future. Fixes: dbce412 ("platform/x86/intel-uncore-freq: Split common and enumeration part") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Link: https://lore.kernel.org/r/20220304131925.GG28739@kili Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
1 parent c91a5b1 commit f2a6c7e

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

drivers/platform/x86/intel/uncore-frequency/uncore-frequency-common.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ int uncore_freq_common_init(int (*read_control_freq)(struct uncore_data *data, u
231231
++uncore_instance_count;
232232
mutex_unlock(&uncore_lock);
233233

234-
return (!!uncore_root_kobj);
234+
return uncore_root_kobj ? 0 : -ENOMEM;
235235
}
236236
EXPORT_SYMBOL_NS_GPL(uncore_freq_common_init, INTEL_UNCORE_FREQUENCY);
237237

drivers/platform/x86/intel/uncore-frequency/uncore-frequency.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ static int __init intel_uncore_init(void)
225225

226226
ret = uncore_freq_common_init(uncore_read_control_freq, uncore_write_control_freq,
227227
uncore_read_freq);
228-
if (!ret)
228+
if (ret)
229229
goto err_free;
230230

231231
ret = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN,

0 commit comments

Comments
 (0)