summaryrefslogtreecommitdiff
path: root/drivers/soc
diff options
context:
space:
mode:
authorYuanjun Gong <ruc_gongyuanjun@163.com>2023-07-20 17:08:34 +0300
committerBjorn Andersson <andersson@kernel.org>2023-07-22 06:06:34 +0300
commit489d7a8cc286f37f52156100b95751b10e240941 (patch)
treec0892e1a4dc5f865daca14934fddd16fd28cd08c /drivers/soc
parentde3acb7af908ef4fa9fda19cdfce1cc30cb48388 (diff)
downloadlinux-489d7a8cc286f37f52156100b95751b10e240941.tar.xz
soc: qcom: use devm_clk_get_enabled() in gsbi_probe()
in gsbi_probe(), the return value of function clk_prepare_enable() should be checked, since it may fail. using devm_clk_get_enabled() instead of devm_clk_get() and clk_prepare_enable() can avoid this problem. Signed-off-by: Yuanjun Gong <ruc_gongyuanjun@163.com> Link: https://lore.kernel.org/r/20230720140834.33557-1-ruc_gongyuanjun@163.com [bjorn: Dropped unnecessary "ret" variable] Signed-off-by: Bjorn Andersson <andersson@kernel.org>
Diffstat (limited to 'drivers/soc')
-rw-r--r--drivers/soc/qcom/qcom_gsbi.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/drivers/soc/qcom/qcom_gsbi.c b/drivers/soc/qcom/qcom_gsbi.c
index f1742e5bddb9..df7907a83aa8 100644
--- a/drivers/soc/qcom/qcom_gsbi.c
+++ b/drivers/soc/qcom/qcom_gsbi.c
@@ -129,7 +129,7 @@ static int gsbi_probe(struct platform_device *pdev)
const struct of_device_id *match;
void __iomem *base;
struct gsbi_info *gsbi;
- int i, ret;
+ int i;
u32 mask, gsbi_num;
const struct crci_config *config = NULL;
@@ -178,12 +178,10 @@ static int gsbi_probe(struct platform_device *pdev)
dev_info(&pdev->dev, "GSBI port protocol: %d crci: %d\n",
gsbi->mode, gsbi->crci);
- gsbi->hclk = devm_clk_get(&pdev->dev, "iface");
+ gsbi->hclk = devm_clk_get_enabled(&pdev->dev, "iface");
if (IS_ERR(gsbi->hclk))
return PTR_ERR(gsbi->hclk);
- clk_prepare_enable(gsbi->hclk);
-
writel_relaxed((gsbi->mode << GSBI_PROTOCOL_SHIFT) | gsbi->crci,
base + GSBI_CTRL_REG);
@@ -211,10 +209,7 @@ static int gsbi_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, gsbi);
- ret = of_platform_populate(node, NULL, NULL, &pdev->dev);
- if (ret)
- clk_disable_unprepare(gsbi->hclk);
- return ret;
+ return of_platform_populate(node, NULL, NULL, &pdev->dev);
}
static int gsbi_remove(struct platform_device *pdev)