]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/4.9.168/soc-qcom-gsbi-fix-error-handling-in-gsbi_probe.patch
Linux 4.9.168
[thirdparty/kernel/stable-queue.git] / releases / 4.9.168 / soc-qcom-gsbi-fix-error-handling-in-gsbi_probe.patch
CommitLineData
b806a291
SL
1From 172974d91ff815244e7c7b70f075744e5e343585 Mon Sep 17 00:00:00 2001
2From: Alexey Khoroshilov <khoroshilov@ispras.ru>
3Date: Sat, 8 Dec 2018 01:57:04 +0300
4Subject: soc: qcom: gsbi: Fix error handling in gsbi_probe()
5
6[ Upstream commit 8cd09a3dd3e176c62da67efcd477a44a8d87185e ]
7
8If of_platform_populate() fails in gsbi_probe(),
9gsbi->hclk is left undisabled.
10
11Found by Linux Driver Verification project (linuxtesting.org).
12
13Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
14Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
15Signed-off-by: Andy Gross <andy.gross@linaro.org>
16Signed-off-by: Sasha Levin <sashal@kernel.org>
17---
18 drivers/soc/qcom/qcom_gsbi.c | 7 +++++--
19 1 file changed, 5 insertions(+), 2 deletions(-)
20
21diff --git a/drivers/soc/qcom/qcom_gsbi.c b/drivers/soc/qcom/qcom_gsbi.c
22index 09c669e70d63..038abc377fdb 100644
23--- a/drivers/soc/qcom/qcom_gsbi.c
24+++ b/drivers/soc/qcom/qcom_gsbi.c
25@@ -138,7 +138,7 @@ static int gsbi_probe(struct platform_device *pdev)
26 struct resource *res;
27 void __iomem *base;
28 struct gsbi_info *gsbi;
29- int i;
30+ int i, ret;
31 u32 mask, gsbi_num;
32 const struct crci_config *config = NULL;
33
34@@ -221,7 +221,10 @@ static int gsbi_probe(struct platform_device *pdev)
35
36 platform_set_drvdata(pdev, gsbi);
37
38- return of_platform_populate(node, NULL, NULL, &pdev->dev);
39+ ret = of_platform_populate(node, NULL, NULL, &pdev->dev);
40+ if (ret)
41+ clk_disable_unprepare(gsbi->hclk);
42+ return ret;
43 }
44
45 static int gsbi_remove(struct platform_device *pdev)
46--
472.19.1
48