ASoC: fsl: fsl_asrc: Check for clk_prepare_enable() error
Subsystems (3)
Fabio Estevam
reviewerPATCH v2 1/1 ASoC: fsl: fsl_asrc: Check for clk_prepare_enable() error
From: Fabio Estevam <[email protected]>
clk_prepare_enable() may fail, so we should better check its return value and propagate it in the case of error.
---
Changes since v1:
- Also handle the error for asrck_clk[i] as suggested by Nicolin
sound/soc/fsl/fsl_asrc.c | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-)
sound/soc/fsl/fsl_asrc.c +20 -5
@@ -931,14 +931,29 @@ static int fsl_asrc_probe(struct platform_device *pdev)static int fsl_asrc_runtime_resume (struct device *dev) {struct fsl_asrc *asrc_priv =dev_get_drvdata (dev); -int i; +int i, ret; -clk_prepare_enable (asrc_priv->mem_clk); -clk_prepare_enable (asrc_priv->ipg_clk); -for (i =0 ; i <ASRC_CLK_MAX_NUM ; i++) -clk_prepare_enable (asrc_priv->asrck_clk[i]); + ret =clk_prepare_enable (asrc_priv->mem_clk); +if (ret) +return ret; + ret =clk_prepare_enable (asrc_priv->ipg_clk); +if (ret) + goto disable_mem_clk; +for (i =0 ; i <ASRC_CLK_MAX_NUM ; i++) { + ret =clk_prepare_enable (asrc_priv->asrck_clk[i]); +if (ret) + goto disable_asrck_clk; + }return 0 ; + +disable_asrck_clk: +for (i--; i >=0 ; i--) +clk_disable_unprepare (asrc_priv->asrck_clk[i]); +clk_disable_unprepare (asrc_priv->ipg_clk); +disable_mem_clk: +clk_disable_unprepare (asrc_priv->mem_clk); +return ret; }static int fsl_asrc_runtime_suspend (struct device *dev)
Signature · 1 line
1.9.1
Quoted 6 lines · Fabio Estevam
From: Fabio Estevam <[email protected]>
clk_prepare_enable()may fail, so we should better check its return value and propagate it in the case of error.Signed-off-by Fabio Estevam <[email protected]>
Thank you
Nicolin
Quoted 50 lines
---
Changes since v1:
- Also handle the error for asrck_clk[i] as suggested by Nicolinsound/soc/fsl/fsl_asrc.c | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-)sound/soc/fsl/fsl_asrc.c +20
-5@@ -931,14 +931,29 @@ static int fsl_asrc_probe(struct platform_device *pdev)static int fsl_asrc_runtime_resume (struct device *dev) {struct fsl_asrc *asrc_priv =dev_get_drvdata (dev); -int i; +int i, ret; -clk_prepare_enable (asrc_priv->mem_clk); -clk_prepare_enable (asrc_priv->ipg_clk); -for (i =0 ; i <ASRC_CLK_MAX_NUM ; i++) -clk_prepare_enable (asrc_priv->asrck_clk[i]); + ret =clk_prepare_enable (asrc_priv->mem_clk); +if (ret) +return ret; + ret =clk_prepare_enable (asrc_priv->ipg_clk); +if (ret) + goto disable_mem_clk; +for (i =0 ; i <ASRC_CLK_MAX_NUM ; i++) { + ret =clk_prepare_enable (asrc_priv->asrck_clk[i]); +if (ret) + goto disable_asrck_clk; + }return 0 ; + +disable_asrck_clk: +for (i--; i >=0 ; i--) +clk_disable_unprepare (asrc_priv->asrck_clk[i]); +clk_disable_unprepare (asrc_priv->ipg_clk); +disable_mem_clk: +clk_disable_unprepare (asrc_priv->mem_clk); +return ret; }static int fsl_asrc_runtime_suspend (struct device *dev)Signature · 1 line
1.9.1
Mark Brown
maintainerApplied "ASoC: fsl: fsl_asrc: Check for clk_prepare_enable() error" to the asoc tree
In reply to Fabio EstevamThe patch
ASoC: fsl: fsl_asrc: Check for clk_prepare_enable() error
has been applied to the asoc tree at
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark
Quoted 1 line
From
b1ade0f2afe283d59eb313e5717870fdb831fc4eMon Sep 17 00:00:00 2001
From: Fabio Estevam <[email protected]>
Date: Sat, 20 Jun 2015 18:00:13 -0300
Subject: [PATCH] ASoC: fsl: fsl_asrc: Check for clk_prepare_enable() error
clk_prepare_enable() may fail, so we should better check its return value and propagate it in the case of error.
--- sound/soc/fsl/fsl_asrc.c | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-)
sound/soc/fsl/fsl_asrc.c +20 -5
@@ -931,14 +931,29 @@ static int fsl_asrc_probe(struct platform_device *pdev)static int fsl_asrc_runtime_resume (struct device *dev) {struct fsl_asrc *asrc_priv =dev_get_drvdata (dev); -int i; +int i, ret; -clk_prepare_enable (asrc_priv->mem_clk); -clk_prepare_enable (asrc_priv->ipg_clk); -for (i =0 ; i <ASRC_CLK_MAX_NUM ; i++) -clk_prepare_enable (asrc_priv->asrck_clk[i]); + ret =clk_prepare_enable (asrc_priv->mem_clk); +if (ret) +return ret; + ret =clk_prepare_enable (asrc_priv->ipg_clk); +if (ret) + goto disable_mem_clk; +for (i =0 ; i <ASRC_CLK_MAX_NUM ; i++) { + ret =clk_prepare_enable (asrc_priv->asrck_clk[i]); +if (ret) + goto disable_asrck_clk; + }return 0 ; + +disable_asrck_clk: +for (i--; i >=0 ; i--) +clk_disable_unprepare (asrc_priv->asrck_clk[i]); +clk_disable_unprepare (asrc_priv->ipg_clk); +disable_mem_clk: +clk_disable_unprepare (asrc_priv->mem_clk); +return ret; }static int fsl_asrc_runtime_suspend (struct device *dev)
Signature · 1 line
2.1.4