Message ID | 20221010173833.1375381-1-biju.das.jz@bp.renesas.com (mailing list archive) |
---|---|
State | Accepted |
Delegated to: | Pavel Machek |
Headers | show |
Series | [5.10.y-cip] ASoC: sh: rz-ssi: Improve error handling in rz_ssi_probe() error path | expand |
Hi, > -----Original Message----- > From: Biju Das <biju.das.jz@bp.renesas.com> > Sent: Tuesday, October 11, 2022 2:39 AM > To: cip-dev@lists.cip-project.org; iwamatsu nobuhiro(岩松 信洋 □SWC◯A > CT) <nobuhiro1.iwamatsu@toshiba.co.jp>; Pavel Machek > <pavel@denx.de> > Cc: Chris Paterson <chris.paterson2@renesas.com>; Biju Das > <biju.das@bp.renesas.com> > Subject: [PATCH 5.10.y-cip] ASoC: sh: rz-ssi: Improve error handling in > rz_ssi_probe() error path > > commit c75ed9f54ce8d349fee557f2b471a4d637ed2a6b upstream. > > We usually do cleanup in reverse order of init. Currently in case of error > rz_ssi_release_dma_channels() done in the reverse order. This patch improves > error handling in rz_ssi_probe() error path. > > While at it, use "goto cleanup" style to reduce code duplication. > > Reported-by: Pavel Machek <pavel@denx.de> > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com> > Link: > https://lore.kernel.org/r/20220728092612.38858-1-biju.das.jz@bp.renesas.co > m > Signed-off-by: Mark Brown <broonie@kernel.org> > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com> > --- > sound/soc/sh/rz-ssi.c | 26 +++++++++++++++----------- > 1 file changed, 15 insertions(+), 11 deletions(-) Looks good to me this patch. If there are no other comments, I can apply. Test: https://gitlab.com/cip-project/cip-kernel/linux-cip/-/pipelines/663548693 Best regards, Nobuhiro
Hi! > > We usually do cleanup in reverse order of init. Currently in case of error > > rz_ssi_release_dma_channels() done in the reverse order. This patch improves > > error handling in rz_ssi_probe() error path. > > > > While at it, use "goto cleanup" style to reduce code duplication. > > > > Reported-by: Pavel Machek <pavel@denx.de> > > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com> > > Link: > > https://lore.kernel.org/r/20220728092612.38858-1-biju.das.jz@bp.renesas.co > > m > > Signed-off-by: Mark Brown <broonie@kernel.org> > > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com> > > --- > > sound/soc/sh/rz-ssi.c | 26 +++++++++++++++----------- > > 1 file changed, 15 insertions(+), 11 deletions(-) > > Looks good to me this patch. > If there are no other comments, I can apply. > > Test: > > https://gitlab.com/cip-project/cip-kernel/linux-cip/-/pipelines/663548693 Looks ok to me: Reviewed-by: Pavel Machek <pavel@denx.de> Best regards, Pavel
Hi all, > -----Original Message----- > From: Pavel Machek <pavel@denx.de> > Sent: Tuesday, October 11, 2022 8:24 PM > To: iwamatsu nobuhiro(岩松 信洋 □SWC◯ACT) > <nobuhiro1.iwamatsu@toshiba.co.jp> > Cc: biju.das.jz@bp.renesas.com; cip-dev@lists.cip-project.org; > pavel@denx.de; chris.paterson2@renesas.com; biju.das@bp.renesas.com > Subject: Re: [PATCH 5.10.y-cip] ASoC: sh: rz-ssi: Improve error handling in > rz_ssi_probe() error path > > Hi! > > > > We usually do cleanup in reverse order of init. Currently in case of > > > error > > > rz_ssi_release_dma_channels() done in the reverse order. This patch > > > improves error handling in rz_ssi_probe() error path. > > > > > > While at it, use "goto cleanup" style to reduce code duplication. > > > > > > Reported-by: Pavel Machek <pavel@denx.de> > > > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com> > > > Link: > > > https://lore.kernel.org/r/20220728092612.38858-1-biju.das.jz@bp.rene > > > sas.co > > > m > > > Signed-off-by: Mark Brown <broonie@kernel.org> > > > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com> > > > --- > > > sound/soc/sh/rz-ssi.c | 26 +++++++++++++++----------- > > > 1 file changed, 15 insertions(+), 11 deletions(-) > > > > Looks good to me this patch. > > If there are no other comments, I can apply. > > > > Test: > > > https://gitlab.com/cip-project/cip-kernel/linux-cip/-/pipelines/6635 > > > 48693 > > Looks ok to me: > > Reviewed-by: Pavel Machek <pavel@denx.de> Thank you. I pushed with your Reviewed-by tag. Best regards, Nobuhiro
diff --git a/sound/soc/sh/rz-ssi.c b/sound/soc/sh/rz-ssi.c index ae57c7aa580e..4901a660ffc5 100644 --- a/sound/soc/sh/rz-ssi.c +++ b/sound/soc/sh/rz-ssi.c @@ -1016,32 +1016,36 @@ static int rz_ssi_probe(struct platform_device *pdev) ssi->rstc = devm_reset_control_get_exclusive(&pdev->dev, NULL); if (IS_ERR(ssi->rstc)) { - rz_ssi_release_dma_channels(ssi); - return PTR_ERR(ssi->rstc); + ret = PTR_ERR(ssi->rstc); + goto err_reset; } reset_control_deassert(ssi->rstc); pm_runtime_enable(&pdev->dev); ret = pm_runtime_resume_and_get(&pdev->dev); if (ret < 0) { - rz_ssi_release_dma_channels(ssi); - pm_runtime_disable(ssi->dev); - reset_control_assert(ssi->rstc); - return dev_err_probe(ssi->dev, ret, "pm_runtime_resume_and_get failed\n"); + dev_err(&pdev->dev, "pm_runtime_resume_and_get failed\n"); + goto err_pm; } ret = devm_snd_soc_register_component(&pdev->dev, &rz_ssi_soc_component, rz_ssi_soc_dai, ARRAY_SIZE(rz_ssi_soc_dai)); if (ret < 0) { - rz_ssi_release_dma_channels(ssi); - - pm_runtime_put(ssi->dev); - pm_runtime_disable(ssi->dev); - reset_control_assert(ssi->rstc); dev_err(&pdev->dev, "failed to register snd component\n"); + goto err_snd_soc; } + return 0; + +err_snd_soc: + pm_runtime_put(ssi->dev); +err_pm: + pm_runtime_disable(ssi->dev); + reset_control_assert(ssi->rstc); +err_reset: + rz_ssi_release_dma_channels(ssi); + return ret; }