lkml.org 
[lkml]   [2021]   [Jan]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 22/31] memory: samsung: exynos5422-dmc: fix return error in exynos5_init_freq_table
Date
We can't always return -EINVAL, let's fix it.

Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>
---
drivers/memory/samsung/exynos5422-dmc.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/memory/samsung/exynos5422-dmc.c b/drivers/memory/samsung/exynos5422-dmc.c
index c5ee4121a4d2..62a83633f837 100644
--- a/drivers/memory/samsung/exynos5422-dmc.c
+++ b/drivers/memory/samsung/exynos5422-dmc.c
@@ -353,16 +353,20 @@ static int exynos5_init_freq_table(struct exynos5_dmc *dmc,

dmc->opp = devm_kmalloc_array(dmc->dev, dmc->opp_count,
sizeof(struct dmc_opp_table), GFP_KERNEL);
- if (!dmc->opp)
+ if (!dmc->opp) {
+ ret = -ENOMEM;
goto err_opp;
+ }

idx = dmc->opp_count - 1;
for (i = 0, freq = ULONG_MAX; i < dmc->opp_count; i++, freq--) {
struct dev_pm_opp *opp;

opp = dev_pm_opp_find_freq_floor(dmc->dev, &freq);
- if (IS_ERR(opp))
+ if (IS_ERR(opp)) {
+ ret = PTR_ERR(opp);
goto err_opp;
+ }

dmc->opp[idx - i].freq_hz = freq;
dmc->opp[idx - i].volt_uv = dev_pm_opp_get_voltage(opp);
@@ -375,7 +379,7 @@ static int exynos5_init_freq_table(struct exynos5_dmc *dmc,
err_opp:
dev_pm_opp_of_remove_table(dmc->dev);

- return -EINVAL;
+ return ret;
}

/**
--
2.25.1
\
 
 \ /
  Last update: 2021-01-01 18:02    [W:0.267 / U:1.616 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site