ASoC: fsl: fsl_asrc: Check for clk_prepare_enable() error
Subsystems (3)
Fabio Estevam
reviewerPATCH 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.
Signed-off-by Fabio Estevam <[email protected]>
--- sound/soc/fsl/fsl_asrc.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)
sound/soc/fsl/fsl_asrc.c +11 -3
@@ -931,14 +931,22 @@ 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); + 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++)clk_prepare_enable (asrc_priv->asrck_clk[i]);return 0 ; + +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
Nicolin Chen
reviewerQuoted 22 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]>--- sound/soc/fsl/fsl_asrc.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)sound/soc/fsl/fsl_asrc.c +1
-2@@ -931,14 +931,22 @@ 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);
sound/soc/fsl/fsl_asrc.c static int fsl_asrc_probe(struct platform_device *pdev) · line 944
Quoted 10 lines
sound/soc/fsl/fsl_asrc.c +6
-1-clk_prepare_enable (asrc_priv->ipg_clk); + 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++)clk_prepare_enable (asrc_priv->asrck_clk[i]);
How about these clocks?
disable_clk:
for (i--; i >= 0; i--) clk_disable_unprepare(asrc_priv->asrc_clk[i]);
Might be better?
Thank you
Nicolin