diff mbox series

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

Message ID 1557408607-25115-2-git-send-email-viorel.suman@nxp.com (mailing list archive)
State New, archived
Headers show
Series ASoC: ak4458: fail on probe if codec is not present | expand

Commit Message

Viorel Suman May 9, 2019, 1:30 p.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 | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Mark Brown May 12, 2019, 7:54 a.m. UTC | #1
On Thu, May 09, 2019 at 01:30:36PM +0000, Viorel Suman wrote:

> -	return ret;
> +	/* Return a negative error code only. */
> +	return (ret < 0 ? ret : 0);

Please write normal conditional statements to help people who have to
read the code.
diff mbox series

Patch

diff --git a/sound/soc/codecs/ak4458.c b/sound/soc/codecs/ak4458.c
index eab7c76..4795e32 100644
--- a/sound/soc/codecs/ak4458.c
+++ b/sound/soc/codecs/ak4458.c
@@ -304,7 +304,8 @@  static int ak4458_rstn_control(struct snd_soc_component *component, int bit)
 					  AK4458_00_CONTROL1,
 					  AK4458_RSTN_MASK,
 					  0x0);
-	return ret;
+	/* Return a negative error code only. */
+	return (ret < 0 ? ret : 0);
 }
 
 static int ak4458_hw_params(struct snd_pcm_substream *substream,