Skip to content

Commit c4f16e9

Browse files
committed
memory: samsung: exynos5422-dmc: Do not ignore return code of regmap_read()
Check for regmap_read() return code before using the read value in following write in exynos5_switch_timing_regs(). Pass reading error code to the callers. This does not introduce proper error handling for such failed reads (and obviously regmap_write() error is still ignored) because the driver ignored this in all places. Therefor it only fixes reported issue while matching current driver coding style: drivers/memory/samsung/exynos5422-dmc.c: In function 'exynos5_switch_timing_regs': >> drivers/memory/samsung/exynos5422-dmc.c:216:6: warning: variable 'ret' set but not used [-Wunused-but-set-variable] Reported-by: kernel test robot <lkp@intel.com> Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
1 parent b3a9e3b commit c4f16e9

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

‎drivers/memory/samsung/exynos5422-dmc.c‎

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -270,19 +270,23 @@ static int find_target_freq_idx(struct exynos5_dmc *dmc,
270270
* This function switches between these banks according to the
271271
* currently used clock source.
272272
*/
273-
static void exynos5_switch_timing_regs(struct exynos5_dmc *dmc, bool set)
273+
static int exynos5_switch_timing_regs(struct exynos5_dmc *dmc, bool set)
274274
{
275275
unsigned int reg;
276276
int ret;
277277

278278
ret = regmap_read(dmc->clk_regmap, CDREX_LPDDR3PHY_CON3, &reg);
279+
if (ret)
280+
return ret;
279281

280282
if (set)
281283
reg |= EXYNOS5_TIMING_SET_SWI;
282284
else
283285
reg &= ~EXYNOS5_TIMING_SET_SWI;
284286

285287
regmap_write(dmc->clk_regmap, CDREX_LPDDR3PHY_CON3, reg);
288+
289+
return 0;
286290
}
287291

288292
/**
@@ -516,7 +520,7 @@ exynos5_dmc_switch_to_bypass_configuration(struct exynos5_dmc *dmc,
516520
/*
517521
* Delays are long enough, so use them for the new coming clock.
518522
*/
519-
exynos5_switch_timing_regs(dmc, USE_MX_MSPLL_TIMINGS);
523+
ret = exynos5_switch_timing_regs(dmc, USE_MX_MSPLL_TIMINGS);
520524

521525
return ret;
522526
}
@@ -577,7 +581,9 @@ exynos5_dmc_change_freq_and_volt(struct exynos5_dmc *dmc,
577581

578582
clk_set_rate(dmc->fout_bpll, target_rate);
579583

580-
exynos5_switch_timing_regs(dmc, USE_BPLL_TIMINGS);
584+
ret = exynos5_switch_timing_regs(dmc, USE_BPLL_TIMINGS);
585+
if (ret)
586+
goto disable_clocks;
581587

582588
ret = clk_set_parent(dmc->mout_mclk_cdrex, dmc->mout_bpll);
583589
if (ret)

0 commit comments

Comments
 (0)