diff mbox

ASoC: da7218: Fix incorrect usage of bitwise '&' operator for SRM check

Message ID 20170503135406.5EA1E3FB6C@swsrvapps-01.diasemi.com (mailing list archive)
State Accepted
Commit 679d026932f23112e89e0466742a9c06f8160635
Headers show

Commit Message

Adam Thomson May 3, 2017, 1:54 p.m. UTC
In the SRM lock check section of code the '&' bitwise operator is
used as part of checking lock status. Functionally the code works
as intended, but the conditional statement is a boolean comparison
so should really use '&&' logical operator instead. This commit
rectifies this discrepancy.

Signed-off-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
---
 sound/soc/codecs/da7218.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Takashi Sakamoto May 3, 2017, 2:10 p.m. UTC | #1
On May 3 2017 22:54, Adam Thomson wrote:
> In the SRM lock check section of code the '&' bitwise operator is
> used as part of checking lock status. Functionally the code works
> as intended, but the conditional statement is a boolean comparison
> so should really use '&&' logical operator instead. This commit
> rectifies this discrepancy.
> 
> Signed-off-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
> ---
>  sound/soc/codecs/da7218.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>

> diff --git a/sound/soc/codecs/da7218.c b/sound/soc/codecs/da7218.c
> index d256ebf..6e1940e 100644
> --- a/sound/soc/codecs/da7218.c
> +++ b/sound/soc/codecs/da7218.c
> @@ -1457,7 +1457,7 @@ static int da7218_dai_event(struct snd_soc_dapm_widget *w,
>  				++i;
>  				msleep(DA7218_SRM_CHECK_DELAY);
>  			}
> -		} while ((i < DA7218_SRM_CHECK_TRIES) & (!success));
> +		} while ((i < DA7218_SRM_CHECK_TRIES) && (!success));
>  
>  		if (!success)
>  			dev_warn(codec->dev, "SRM failed to lock\n");

Would you please fix codes for da7213, too?


Regards

Takashi Sakamoto
Adam Thomson May 3, 2017, 2:19 p.m. UTC | #2
On 03 May 2017 15:10, Takashi Sakamoto wrote:

> On May 3 2017 22:54, Adam Thomson wrote:
> > In the SRM lock check section of code the '&' bitwise operator is
> > used as part of checking lock status. Functionally the code works
> > as intended, but the conditional statement is a boolean comparison
> > so should really use '&&' logical operator instead. This commit
> > rectifies this discrepancy.
> >
> > Signed-off-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
> > ---
> >  sound/soc/codecs/da7218.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>

Thanks :)

> > diff --git a/sound/soc/codecs/da7218.c b/sound/soc/codecs/da7218.c
> > index d256ebf..6e1940e 100644
> > --- a/sound/soc/codecs/da7218.c
> > +++ b/sound/soc/codecs/da7218.c
> > @@ -1457,7 +1457,7 @@ static int da7218_dai_event(struct
> snd_soc_dapm_widget *w,
> >  				++i;
> >  				msleep(DA7218_SRM_CHECK_DELAY);
> >  			}
> > -		} while ((i < DA7218_SRM_CHECK_TRIES) & (!success));
> > +		} while ((i < DA7218_SRM_CHECK_TRIES) && (!success));
> >
> >  		if (!success)
> >  			dev_warn(codec->dev, "SRM failed to lock\n");
> 
> Would you please fix codes for da7213, too?

Thought you may be re-spinning your patch, but that's fine. I'll send an update
for da7213 as well.
diff mbox

Patch

diff --git a/sound/soc/codecs/da7218.c b/sound/soc/codecs/da7218.c
index d256ebf..6e1940e 100644
--- a/sound/soc/codecs/da7218.c
+++ b/sound/soc/codecs/da7218.c
@@ -1457,7 +1457,7 @@  static int da7218_dai_event(struct snd_soc_dapm_widget *w,
 				++i;
 				msleep(DA7218_SRM_CHECK_DELAY);
 			}
-		} while ((i < DA7218_SRM_CHECK_TRIES) & (!success));
+		} while ((i < DA7218_SRM_CHECK_TRIES) && (!success));
 
 		if (!success)
 			dev_warn(codec->dev, "SRM failed to lock\n");