Skip to content

Commit

Permalink
ASoC: mediatek: Check for error clk pointer
Browse files Browse the repository at this point in the history
[ Upstream commit 9de2b9286a6dd16966959b3cb34fc2ddfd39213e ]

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

Fixes: 6078c65 ("soc: mediatek: Refine scpsys to support multiple platform")
Signed-off-by: Jiasheng Jiang <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Mark Brown <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
  • Loading branch information
JiangJias authored and gregkh committed Jan 27, 2022
1 parent c1f9fbe commit e4f5f27
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions drivers/soc/mediatek/mtk-scpsys.c
Original file line number Diff line number Diff line change
Expand Up @@ -341,12 +341,17 @@ static int scpsys_power_off(struct generic_pm_domain *genpd)
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;

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]);
if (IS_ERR(clk[i]))
return PTR_ERR(clk[i]);
}

return 0;
}

static struct scp *init_scp(struct platform_device *pdev,
Expand All @@ -356,7 +361,7 @@ static struct scp *init_scp(struct platform_device *pdev,
{
struct genpd_onecell_data *pd_data;
struct resource *res;
int i, j;
int i, j, ret;
struct scp *scp;
struct clk *clk[CLK_MAX];

Expand Down Expand Up @@ -411,7 +416,9 @@ static struct scp *init_scp(struct platform_device *pdev,

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++) {
struct scp_domain *scpd = &scp->domains[i];
Expand Down

0 comments on commit e4f5f27

Please sign in to comment.