summaryrefslogtreecommitdiffstats
path: root/drivers/soc/samsung/exynos-asv.c
diff options
context:
space:
mode:
authorKrzysztof Kozlowski <krzk@kernel.org>2020-12-07 20:05:15 +0100
committerKrzysztof Kozlowski <krzk@kernel.org>2021-01-03 17:02:56 +0100
commit4561560dfb4f847a0b327d48bdd1f45bf1b6261f (patch)
treeb3e9e53d63e4ce5dfd719a0ef5e1d48e0df3cef8 /drivers/soc/samsung/exynos-asv.c
parent0458b88267c637fb872b0359da9ff0b243081e9e (diff)
downloadlinux-4561560dfb4f847a0b327d48bdd1f45bf1b6261f.tar.bz2
soc: samsung: exynos-asv: handle reading revision register error
If regmap_read() fails, the product_id local variable will contain random value from the stack. Do not try to parse such value and fail the ASV driver probe. Fixes: 5ea428595cc5 ("soc: samsung: Add Exynos Adaptive Supply Voltage driver") Cc: <stable@vger.kernel.org> Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org> Reviewed-by: Pankaj Dubey <pankaj.dubey@samsung.com> Link: https://lore.kernel.org/r/20201207190517.262051-3-krzk@kernel.org
Diffstat (limited to 'drivers/soc/samsung/exynos-asv.c')
-rw-r--r--drivers/soc/samsung/exynos-asv.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/soc/samsung/exynos-asv.c b/drivers/soc/samsung/exynos-asv.c
index f653e3533f0f..5daeadc36382 100644
--- a/drivers/soc/samsung/exynos-asv.c
+++ b/drivers/soc/samsung/exynos-asv.c
@@ -129,7 +129,13 @@ static int exynos_asv_probe(struct platform_device *pdev)
return PTR_ERR(asv->chipid_regmap);
}
- regmap_read(asv->chipid_regmap, EXYNOS_CHIPID_REG_PRO_ID, &product_id);
+ ret = regmap_read(asv->chipid_regmap, EXYNOS_CHIPID_REG_PRO_ID,
+ &product_id);
+ if (ret < 0) {
+ dev_err(&pdev->dev, "Cannot read revision from ChipID: %d\n",
+ ret);
+ return -ENODEV;
+ }
switch (product_id & EXYNOS_MASK) {
case 0xE5422000: