]>
Commit | Line | Data |
---|---|---|
b806a291 SL |
1 | From 172974d91ff815244e7c7b70f075744e5e343585 Mon Sep 17 00:00:00 2001 |
2 | From: Alexey Khoroshilov <khoroshilov@ispras.ru> | |
3 | Date: Sat, 8 Dec 2018 01:57:04 +0300 | |
4 | Subject: soc: qcom: gsbi: Fix error handling in gsbi_probe() | |
5 | ||
6 | [ Upstream commit 8cd09a3dd3e176c62da67efcd477a44a8d87185e ] | |
7 | ||
8 | If of_platform_populate() fails in gsbi_probe(), | |
9 | gsbi->hclk is left undisabled. | |
10 | ||
11 | Found by Linux Driver Verification project (linuxtesting.org). | |
12 | ||
13 | Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru> | |
14 | Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org> | |
15 | Signed-off-by: Andy Gross <andy.gross@linaro.org> | |
16 | Signed-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 | ||
21 | diff --git a/drivers/soc/qcom/qcom_gsbi.c b/drivers/soc/qcom/qcom_gsbi.c | |
22 | index 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 | -- | |
47 | 2.19.1 | |
48 |