diff mbox series

[V2,1/2] ASoC: ak4458: rstn_control - return a non-zero on error only

Message ID 1557741724-6859-2-git-send-email-viorel.suman@nxp.com (mailing list archive)
State Accepted
Commit 176a11834b65ec35e3b7a953f87fb9cc41309497
Headers show
Series ASoC: ak4458: fail on probe if codec is not present | expand

Commit Message

Viorel Suman May 13, 2019, 10:02 a.m. UTC
snd_soc_component_update_bits() may return 1 if operation
was successful and the value of the register changed.
Return a non-zero in ak4458_rstn_control for an error only.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
---
 sound/soc/codecs/ak4458.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Daniel Baluta May 13, 2019, 11:12 a.m. UTC | #1
On Mon, May 13, 2019 at 1:04 PM Viorel Suman <viorel.suman@nxp.com> wrote:
>
> snd_soc_component_update_bits() may return 1 if operation
> was successful and the value of the register changed.
> Return a non-zero in ak4458_rstn_control for an error only.
>
> Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
> Signed-off-by: Viorel Suman <viorel.suman@nxp.com>

Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>

> ---
>  sound/soc/codecs/ak4458.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/sound/soc/codecs/ak4458.c b/sound/soc/codecs/ak4458.c
> index eab7c76..baf990a 100644
> --- a/sound/soc/codecs/ak4458.c
> +++ b/sound/soc/codecs/ak4458.c
> @@ -304,7 +304,10 @@ static int ak4458_rstn_control(struct snd_soc_component *component, int bit)
>                                           AK4458_00_CONTROL1,
>                                           AK4458_RSTN_MASK,
>                                           0x0);
> -       return ret;
> +       if (ret < 0)
> +               return ret;
> +
> +       return 0;
>  }
>
>  static int ak4458_hw_params(struct snd_pcm_substream *substream,
> --
> 2.7.4
>
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel@alsa-project.org
> https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
diff mbox series

Patch

diff --git a/sound/soc/codecs/ak4458.c b/sound/soc/codecs/ak4458.c
index eab7c76..baf990a 100644
--- a/sound/soc/codecs/ak4458.c
+++ b/sound/soc/codecs/ak4458.c
@@ -304,7 +304,10 @@  static int ak4458_rstn_control(struct snd_soc_component *component, int bit)
 					  AK4458_00_CONTROL1,
 					  AK4458_RSTN_MASK,
 					  0x0);
-	return ret;
+	if (ret < 0)
+		return ret;
+
+	return 0;
 }
 
 static int ak4458_hw_params(struct snd_pcm_substream *substream,