diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2022-03-04 16:19:25 +0300 |
---|---|---|
committer | Hans de Goede <hdegoede@redhat.com> | 2022-03-08 16:33:23 +0100 |
commit | f2a6c7e7474001842a4adaf042d12206c27fc391 (patch) | |
tree | 02071ff85116c54a23843f53a6320e764d503386 /drivers/platform/x86/intel | |
parent | c91a5b1c221a58d008485cf7d02ccce73108b119 (diff) | |
download | linux-f2a6c7e7474001842a4adaf042d12206c27fc391.tar.gz linux-f2a6c7e7474001842a4adaf042d12206c27fc391.tar.bz2 linux-f2a6c7e7474001842a4adaf042d12206c27fc391.zip |
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: dbce412a7733 ("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>
Diffstat (limited to 'drivers/platform/x86/intel')
-rw-r--r-- | drivers/platform/x86/intel/uncore-frequency/uncore-frequency-common.c | 2 | ||||
-rw-r--r-- | drivers/platform/x86/intel/uncore-frequency/uncore-frequency.c | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/drivers/platform/x86/intel/uncore-frequency/uncore-frequency-common.c b/drivers/platform/x86/intel/uncore-frequency/uncore-frequency-common.c index e4d5a7960234..84eabd6156bb 100644 --- a/drivers/platform/x86/intel/uncore-frequency/uncore-frequency-common.c +++ b/drivers/platform/x86/intel/uncore-frequency/uncore-frequency-common.c @@ -231,7 +231,7 @@ int uncore_freq_common_init(int (*read_control_freq)(struct uncore_data *data, u ++uncore_instance_count; mutex_unlock(&uncore_lock); - return (!!uncore_root_kobj); + return uncore_root_kobj ? 0 : -ENOMEM; } EXPORT_SYMBOL_NS_GPL(uncore_freq_common_init, INTEL_UNCORE_FREQUENCY); diff --git a/drivers/platform/x86/intel/uncore-frequency/uncore-frequency.c b/drivers/platform/x86/intel/uncore-frequency/uncore-frequency.c index 791af0e287e4..c61f804dd44e 100644 --- a/drivers/platform/x86/intel/uncore-frequency/uncore-frequency.c +++ b/drivers/platform/x86/intel/uncore-frequency/uncore-frequency.c @@ -225,7 +225,7 @@ static int __init intel_uncore_init(void) ret = uncore_freq_common_init(uncore_read_control_freq, uncore_write_control_freq, uncore_read_freq); - if (!ret) + if (ret) goto err_free; ret = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, |