[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <trinity-2a727d96-0335-4d03-8f30-e22a0e10112d-1643363480085@3c-app-gmx-bap33>
Date: Fri, 28 Jan 2022 10:51:20 +0100
From: Frank Wunderlich <frank-w@...lic-files.de>
To: Jiasheng Jiang <jiasheng@...as.ac.cn>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: matthias.bgg@...il.com, lgirdwood@...il.com, broonie@...nel.org,
linux-arm-kernel@...ts.infradead.org,
linux-mediatek@...ts.infradead.org, linux-kernel@...r.kernel.org,
Jiasheng Jiang <jiasheng@...as.ac.cn>
Subject: BUG: [PATCH v2] isoc: mediatek: Check for error clk pointer
Hi,
this commit is merged in 5.17-rc1 and breaks scpsys on mt7622/bananapi R64
mtk-scpsys: probe of 10006000.power-controller failed with error -2
at least ethernet is affected (i guess usb,sata,btif,... too, but not checked), as gmacs do not get probed as depency of it
after reverting this commit it is working again.
have not yet digged deeper into it why it is failing, but maybe author has an idea
regards Frank
> Gesendet: Mittwoch, 22. Dezember 2021 um 02:51 Uhr
> Von: "Jiasheng Jiang" <jiasheng@...as.ac.cn>
> An: matthias.bgg@...il.com, lgirdwood@...il.com, broonie@...nel.org
> Cc: linux-arm-kernel@...ts.infradead.org, linux-mediatek@...ts.infradead.org, linux-kernel@...r.kernel.org, "Jiasheng Jiang" <jiasheng@...as.ac.cn>
> Betreff: [PATCH v2] isoc: mediatek: Check for error clk pointer
>
> On Wed, Dec 22, 2021 at 01:57:15AM +0800, Mark Brown wrote:
> >> + 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]);
> >
> > This now pays attention to the error code here which is good but...
> >
> >> - init_clks(pdev, clk);
> >> + ret = init_clks(pdev, clk);
> >> + if (ret)
> >> + return ERR_PTR(-ENOMEM);
> >
> > ...then discards it here with a random most likely inappropriate error
> > code.
>
> Yes, you are right and now the return code depending on the
> init_clks().
>
> Fixes: 6078c651947a ("soc: mediatek: Refine scpsys to support multiple platform")
> Signed-off-by: Jiasheng Jiang <jiasheng@...as.ac.cn>
> ---
> Changelog:
>
> v1 -> v2
>
> *Change 1. Change the return code.
> ---
> drivers/soc/mediatek/mtk-scpsys.c | 15 +++++++++++----
> 1 file changed, 11 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/soc/mediatek/mtk-scpsys.c b/drivers/soc/mediatek/mtk-scpsys.c
> index ca75b14931ec..670cc82d17dc 100644
> --- a/drivers/soc/mediatek/mtk-scpsys.c
> +++ b/drivers/soc/mediatek/mtk-scpsys.c
> @@ -411,12 +411,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,
> @@ -426,7 +431,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];
>
> @@ -481,7 +486,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];
> --
> 2.25.1
>
>
> _______________________________________________
> Linux-mediatek mailing list
> Linux-mediatek@...ts.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-mediatek
>
Powered by blists - more mailing lists