2019-05-13 10:29:40

by Viorel Suman

[permalink] [raw]
Subject: [PATCH V2 0/2] ASoC: ak4458: fail on probe if codec is not present

AK4458 is probed successfully even if AK4458 is not present - this
is caused by probe function returning no error on i2c access failure.
The patchset fixes this.

Changes since V1:
Conditional statement rewritten as suggested by Mark.

Viorel Suman (2):
ASoC: ak4458: rstn_control - return a non-zero on error only
ASoC: ak4458: add return value for ak4458_probe

sound/soc/codecs/ak4458.c | 18 +++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)

--
2.7.4


2019-05-13 10:54:08

by Viorel Suman

[permalink] [raw]
Subject: [PATCH V2 1/2] ASoC: ak4458: rstn_control - return a non-zero on error only

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 <[email protected]>
Signed-off-by: Viorel Suman <[email protected]>
---
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

2019-05-13 11:35:46

by Daniel Baluta

[permalink] [raw]
Subject: Re: [alsa-devel] [PATCH V2 1/2] ASoC: ak4458: rstn_control - return a non-zero on error only

On Mon, May 13, 2019 at 1:04 PM Viorel Suman <[email protected]> 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 <[email protected]>
> Signed-off-by: Viorel Suman <[email protected]>

Reviewed-by: Daniel Baluta <[email protected]>

> ---
> 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
> [email protected]
> https://mailman.alsa-project.org/mailman/listinfo/alsa-devel