Commit 9de2b928 authored by Jiasheng Jiang's avatar Jiasheng Jiang Committed by Mark Brown

ASoC: mediatek: Check for error clk pointer

Yes, you are right and now the return code depending on the
init_clks().

Fixes: 6078c651 ("soc: mediatek: Refine scpsys to support multiple platform")
Signed-off-by: default avatarJiasheng Jiang <jiasheng@iscas.ac.cn>
Link: https://lore.kernel.org/r/20211222015157.1025853-1-jiasheng@iscas.ac.cnSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 082482a5
...@@ -411,12 +411,17 @@ static int scpsys_power_off(struct generic_pm_domain *genpd) ...@@ -411,12 +411,17 @@ static int scpsys_power_off(struct generic_pm_domain *genpd)
return ret; return ret;
} }
static void init_clks(struct platform_device *pdev, struct clk **clk) static int init_clks(struct platform_device *pdev, struct clk **clk)
{ {
int i; int i;
for (i = CLK_NONE + 1; i < CLK_MAX; i++) for (i = CLK_NONE + 1; i < CLK_MAX; i++) {
clk[i] = devm_clk_get(&pdev->dev, clk_names[i]); clk[i] = devm_clk_get(&pdev->dev, clk_names[i]);
if (IS_ERR(clk[i]))
return PTR_ERR(clk[i]);
}
return 0;
} }
static struct scp *init_scp(struct platform_device *pdev, static struct scp *init_scp(struct platform_device *pdev,
...@@ -426,7 +431,7 @@ static struct scp *init_scp(struct platform_device *pdev, ...@@ -426,7 +431,7 @@ static struct scp *init_scp(struct platform_device *pdev,
{ {
struct genpd_onecell_data *pd_data; struct genpd_onecell_data *pd_data;
struct resource *res; struct resource *res;
int i, j; int i, j, ret;
struct scp *scp; struct scp *scp;
struct clk *clk[CLK_MAX]; struct clk *clk[CLK_MAX];
...@@ -481,7 +486,9 @@ static struct scp *init_scp(struct platform_device *pdev, ...@@ -481,7 +486,9 @@ static struct scp *init_scp(struct platform_device *pdev,
pd_data->num_domains = num; pd_data->num_domains = num;
init_clks(pdev, clk); ret = init_clks(pdev, clk);
if (ret)
return ERR_PTR(ret);
for (i = 0; i < num; i++) { for (i = 0; i < num; i++) {
struct scp_domain *scpd = &scp->domains[i]; struct scp_domain *scpd = &scp->domains[i];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment