
Ensure that err variables are initialized to 0 to avoid returning uninitialized values. Fixes: bb66b4d115e5 ("arm_mpam: Add mpam_msmon_read() to read monitor value") Signed-off-by: Zeng Heng <zengheng4@huawei.com> --- drivers/platform/mpam/mpam_devices.c | 8 ++++---- include/linux/resctrl.h | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/platform/mpam/mpam_devices.c b/drivers/platform/mpam/mpam_devices.c index 95ce8eb79e2f..661fa7938358 100644 --- a/drivers/platform/mpam/mpam_devices.c +++ b/drivers/platform/mpam/mpam_devices.c @@ -1061,7 +1061,7 @@ static void __ris_msmon_read(void *arg) static int _msmon_read(struct mpam_component *comp, struct mon_read *arg) { - int err, idx; + int err = 0, idx; bool read_again; u64 wait_jiffies; struct mpam_msc *msc; @@ -1610,7 +1610,8 @@ static int __setup_ppi(struct mpam_msc *msc) for_each_cpu(cpu, &msc->accessibility) { struct mpam_msc *empty = *per_cpu_ptr(msc->error_dev_id, cpu); if (empty != NULL) { - pr_err_once("%s shares PPI with %s!\n", dev_name(&msc->pdev->dev), + pr_err_once("%s shares PPI with %s!\n", + dev_name(&msc->pdev->dev), dev_name(&empty->pdev->dev)); return -EBUSY; } @@ -1630,7 +1631,6 @@ static int mpam_msc_setup_error_irq(struct mpam_msc *msc) /* Allocate and initialise the percpu device pointer for PPI */ if (irq_is_percpu(irq)) - return __setup_ppi(msc); /* sanity check: shared interrupts can be routed anywhere? */ @@ -1700,7 +1700,7 @@ static int mpam_dt_parse_resource(struct mpam_msc *msc, struct device_node *np, static int mpam_dt_parse_resources(struct mpam_msc *msc, void *ignored) { - int err, num_ris = 0; + int err = 0, num_ris = 0; const u32 *ris_idx_p; struct device_node *iter, *np; diff --git a/include/linux/resctrl.h b/include/linux/resctrl.h index e2e63b3bd508..958b1f39d016 100644 --- a/include/linux/resctrl.h +++ b/include/linux/resctrl.h @@ -315,9 +315,9 @@ static inline u32 resctrl_get_config_index(u32 closid, case CDP_NONE: return closid; case CDP_CODE: - return (closid * 2) + 1; + return (closid * 2) + 1; case CDP_DATA: - return (closid * 2); + return (closid * 2); } } -- 2.25.1