* [PATCH] ASoC: fsl: fsl_spdif: Check for clk_prepare_enable() error
@ 2015-06-20 21:18 Fabio Estevam
2015-06-21 1:55 ` Nicolin Chen
2015-07-07 13:57 ` Applied "ASoC: fsl: fsl_spdif: Check for clk_prepare_enable() error" to the asoc tree Mark Brown
0 siblings, 2 replies; 3+ messages in thread
From: Fabio Estevam @ 2015-06-20 21:18 UTC (permalink / raw)
To: broonie; +Cc: nicoleotsuka, Fabio Estevam, alsa-devel
From: Fabio Estevam <fabio.estevam@freescale.com>
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 <fabio.estevam@freescale.com>
---
sound/soc/fsl/fsl_spdif.c | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/sound/soc/fsl/fsl_spdif.c b/sound/soc/fsl/fsl_spdif.c
index 8e93221..489fa86 100644
--- a/sound/soc/fsl/fsl_spdif.c
+++ b/sound/soc/fsl/fsl_spdif.c
@@ -482,13 +482,18 @@ static int fsl_spdif_startup(struct snd_pcm_substream *substream,
mask = SCR_TXFIFO_AUTOSYNC_MASK | SCR_TXFIFO_CTRL_MASK |
SCR_TXSEL_MASK | SCR_USRC_SEL_MASK |
SCR_TXFIFO_FSEL_MASK;
- for (i = 0; i < SPDIF_TXRATE_MAX; i++)
- clk_prepare_enable(spdif_priv->txclk[i]);
+ for (i = 0; i < SPDIF_TXRATE_MAX; i++) {
+ ret = clk_prepare_enable(spdif_priv->txclk[i]);
+ if (ret)
+ goto disable_txclk;
+ }
} else {
scr = SCR_RXFIFO_FSEL_IF8 | SCR_RXFIFO_AUTOSYNC;
mask = SCR_RXFIFO_FSEL_MASK | SCR_RXFIFO_AUTOSYNC_MASK|
SCR_RXFIFO_CTL_MASK | SCR_RXFIFO_OFF_MASK;
- clk_prepare_enable(spdif_priv->rxclk);
+ ret = clk_prepare_enable(spdif_priv->rxclk);
+ if (ret)
+ goto err;
}
regmap_update_bits(regmap, REG_SPDIF_SCR, mask, scr);
@@ -497,6 +502,9 @@ static int fsl_spdif_startup(struct snd_pcm_substream *substream,
return 0;
+disable_txclk:
+ for (i--; i >= 0; i--)
+ clk_disable_unprepare(spdif_priv->txclk[i]);
err:
clk_disable_unprepare(spdif_priv->coreclk);
--
1.9.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] ASoC: fsl: fsl_spdif: Check for clk_prepare_enable() error
2015-06-20 21:18 [PATCH] ASoC: fsl: fsl_spdif: Check for clk_prepare_enable() error Fabio Estevam
@ 2015-06-21 1:55 ` Nicolin Chen
2015-07-07 13:57 ` Applied "ASoC: fsl: fsl_spdif: Check for clk_prepare_enable() error" to the asoc tree Mark Brown
1 sibling, 0 replies; 3+ messages in thread
From: Nicolin Chen @ 2015-06-21 1:55 UTC (permalink / raw)
To: Fabio Estevam; +Cc: Fabio Estevam, alsa-devel, broonie
On Sat, Jun 20, 2015 at 06:18:06PM -0300, Fabio Estevam wrote:
> From: Fabio Estevam <fabio.estevam@freescale.com>
>
> 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 <fabio.estevam@freescale.com>
Acked-by: Nicolin Chen <nicoleotsuka@gmail.com>
Thank you
Nicolin
> ---
> sound/soc/fsl/fsl_spdif.c | 14 +++++++++++---
> 1 file changed, 11 insertions(+), 3 deletions(-)
>
> diff --git a/sound/soc/fsl/fsl_spdif.c b/sound/soc/fsl/fsl_spdif.c
> index 8e93221..489fa86 100644
> --- a/sound/soc/fsl/fsl_spdif.c
> +++ b/sound/soc/fsl/fsl_spdif.c
> @@ -482,13 +482,18 @@ static int fsl_spdif_startup(struct snd_pcm_substream *substream,
> mask = SCR_TXFIFO_AUTOSYNC_MASK | SCR_TXFIFO_CTRL_MASK |
> SCR_TXSEL_MASK | SCR_USRC_SEL_MASK |
> SCR_TXFIFO_FSEL_MASK;
> - for (i = 0; i < SPDIF_TXRATE_MAX; i++)
> - clk_prepare_enable(spdif_priv->txclk[i]);
> + for (i = 0; i < SPDIF_TXRATE_MAX; i++) {
> + ret = clk_prepare_enable(spdif_priv->txclk[i]);
> + if (ret)
> + goto disable_txclk;
> + }
> } else {
> scr = SCR_RXFIFO_FSEL_IF8 | SCR_RXFIFO_AUTOSYNC;
> mask = SCR_RXFIFO_FSEL_MASK | SCR_RXFIFO_AUTOSYNC_MASK|
> SCR_RXFIFO_CTL_MASK | SCR_RXFIFO_OFF_MASK;
> - clk_prepare_enable(spdif_priv->rxclk);
> + ret = clk_prepare_enable(spdif_priv->rxclk);
> + if (ret)
> + goto err;
> }
> regmap_update_bits(regmap, REG_SPDIF_SCR, mask, scr);
>
> @@ -497,6 +502,9 @@ static int fsl_spdif_startup(struct snd_pcm_substream *substream,
>
> return 0;
>
> +disable_txclk:
> + for (i--; i >= 0; i--)
> + clk_disable_unprepare(spdif_priv->txclk[i]);
> err:
> clk_disable_unprepare(spdif_priv->coreclk);
>
> --
> 1.9.1
>
^ permalink raw reply [flat|nested] 3+ messages in thread* Applied "ASoC: fsl: fsl_spdif: Check for clk_prepare_enable() error" to the asoc tree
2015-06-20 21:18 [PATCH] ASoC: fsl: fsl_spdif: Check for clk_prepare_enable() error Fabio Estevam
2015-06-21 1:55 ` Nicolin Chen
@ 2015-07-07 13:57 ` Mark Brown
1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2015-07-07 13:57 UTC (permalink / raw)
To: Fabio Estevam, Nicolin Chen, Mark Brown; +Cc: alsa-devel
The patch
ASoC: fsl: fsl_spdif: 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
>From fa3be9208dcb21ae4185f6122137fe7d5cf29d74 Mon Sep 17 00:00:00 2001
From: Fabio Estevam <fabio.estevam@freescale.com>
Date: Sat, 20 Jun 2015 18:18:06 -0300
Subject: [PATCH] ASoC: fsl: fsl_spdif: 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.
Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Acked-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
sound/soc/fsl/fsl_spdif.c | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/sound/soc/fsl/fsl_spdif.c b/sound/soc/fsl/fsl_spdif.c
index 8e93221..489fa86 100644
--- a/sound/soc/fsl/fsl_spdif.c
+++ b/sound/soc/fsl/fsl_spdif.c
@@ -482,13 +482,18 @@ static int fsl_spdif_startup(struct snd_pcm_substream *substream,
mask = SCR_TXFIFO_AUTOSYNC_MASK | SCR_TXFIFO_CTRL_MASK |
SCR_TXSEL_MASK | SCR_USRC_SEL_MASK |
SCR_TXFIFO_FSEL_MASK;
- for (i = 0; i < SPDIF_TXRATE_MAX; i++)
- clk_prepare_enable(spdif_priv->txclk[i]);
+ for (i = 0; i < SPDIF_TXRATE_MAX; i++) {
+ ret = clk_prepare_enable(spdif_priv->txclk[i]);
+ if (ret)
+ goto disable_txclk;
+ }
} else {
scr = SCR_RXFIFO_FSEL_IF8 | SCR_RXFIFO_AUTOSYNC;
mask = SCR_RXFIFO_FSEL_MASK | SCR_RXFIFO_AUTOSYNC_MASK|
SCR_RXFIFO_CTL_MASK | SCR_RXFIFO_OFF_MASK;
- clk_prepare_enable(spdif_priv->rxclk);
+ ret = clk_prepare_enable(spdif_priv->rxclk);
+ if (ret)
+ goto err;
}
regmap_update_bits(regmap, REG_SPDIF_SCR, mask, scr);
@@ -497,6 +502,9 @@ static int fsl_spdif_startup(struct snd_pcm_substream *substream,
return 0;
+disable_txclk:
+ for (i--; i >= 0; i--)
+ clk_disable_unprepare(spdif_priv->txclk[i]);
err:
clk_disable_unprepare(spdif_priv->coreclk);
--
2.1.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-07-07 13:58 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-20 21:18 [PATCH] ASoC: fsl: fsl_spdif: Check for clk_prepare_enable() error Fabio Estevam
2015-06-21 1:55 ` Nicolin Chen
2015-07-07 13:57 ` Applied "ASoC: fsl: fsl_spdif: Check for clk_prepare_enable() error" to the asoc tree Mark Brown
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.