diff mbox series

[22/31] memory: samsung: exynos5422-dmc: fix return error in exynos5_init_freq_table

Message ID 20210101165507.19486-23-tiny.windzz@gmail.com
State New
Headers show
Series Introduce devm_pm_opp_* API | expand

Commit Message

Yangtao Li Jan. 1, 2021, 4:54 p.m. UTC
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(-)

Comments

Krzysztof Kozlowski Jan. 4, 2021, 6:03 p.m. UTC | #1
On Fri, Jan 01, 2021 at 04:54:58PM +0000, Yangtao Li wrote:
> 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(-)

Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org>

I see that the next patch depends on it so feel free to take it via PM
tree. Otherwise let me know.

Best regards,
Krzysztof
diff mbox series

Patch

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;
 }
 
 /**