Skip to content

Commit 946eb87

Browse files
groeckbroonie
authored andcommitted
ASoC: Revert "ASoC: mediatek: Check for error clk pointer"
This reverts commit 9de2b92 ("ASoC: mediatek: Check for error clk pointer"). With this patch in the tree, Chromebooks running the affected hardware no longer boot. Bisect points to this patch, and reverting it fixes the problem. An analysis of the code with this patch applied shows: ret = init_clks(pdev, clk); if (ret) return ERR_PTR(ret); ... for (j = 0; j < MAX_CLKS && data->clk_id[j]; j++) { struct clk *c = clk[data->clk_id[j]]; if (IS_ERR(c)) { dev_err(&pdev->dev, "%s: clk unavailable\n", data->name); return ERR_CAST(c); } scpd->clk[j] = c; } Not all clocks in the clk_names array have to be present. Only the clocks in the data->clk_id array are actually needed. The code already checks if the required clocks are available and bails out if not. The assumption that all clocks have to be present is wrong, and commit 9de2b92 ("ASoC: mediatek: Check for error clk pointer") needs to be reverted. Cc: Jiasheng Jiang <jiasheng@iscas.ac.cn> Cc: Mark Brown <broonie@kernel.org> Cc: James Liao <jamesjj.liao@mediatek.com> Cc: Kevin Hilman <khilman@baylibre.com> Cc: Matthias Brugger <matthias.bgg@gmail.com> Reported-by: Frank Wunderlich <frank-w@public-files.de> Reported-by: Daniel Golle <daniel@makrotopia.org> Fixes: 9de2b92 ("ASoC: mediatek: Check for error clk pointer") Signed-off-by: Guenter Roeck <linux@roeck-us.net> Link: https://lore.kernel.org/r/20220207160923.3911501-1-linux@roeck-us.net Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 618c2dc commit 946eb87

1 file changed

Lines changed: 4 additions & 11 deletions

File tree

drivers/soc/mediatek/mtk-scpsys.c

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -411,17 +411,12 @@ static int scpsys_power_off(struct generic_pm_domain *genpd)
411411
return ret;
412412
}
413413

414-
static int init_clks(struct platform_device *pdev, struct clk **clk)
414+
static void init_clks(struct platform_device *pdev, struct clk **clk)
415415
{
416416
int i;
417417

418-
for (i = CLK_NONE + 1; i < CLK_MAX; i++) {
418+
for (i = CLK_NONE + 1; i < CLK_MAX; i++)
419419
clk[i] = devm_clk_get(&pdev->dev, clk_names[i]);
420-
if (IS_ERR(clk[i]))
421-
return PTR_ERR(clk[i]);
422-
}
423-
424-
return 0;
425420
}
426421

427422
static struct scp *init_scp(struct platform_device *pdev,
@@ -431,7 +426,7 @@ static struct scp *init_scp(struct platform_device *pdev,
431426
{
432427
struct genpd_onecell_data *pd_data;
433428
struct resource *res;
434-
int i, j, ret;
429+
int i, j;
435430
struct scp *scp;
436431
struct clk *clk[CLK_MAX];
437432

@@ -486,9 +481,7 @@ static struct scp *init_scp(struct platform_device *pdev,
486481

487482
pd_data->num_domains = num;
488483

489-
ret = init_clks(pdev, clk);
490-
if (ret)
491-
return ERR_PTR(ret);
484+
init_clks(pdev, clk);
492485

493486
for (i = 0; i < num; i++) {
494487
struct scp_domain *scpd = &scp->domains[i];

0 commit comments

Comments
 (0)