mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [patch 2/2] ALSA: oxfw: fix detect_loud_models() return value
@ 2014-12-12 19:28 Dan Carpenter
  2014-12-13  4:45 ` Takashi Sakamoto
  0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2014-12-12 19:28 UTC (permalink / raw)
  To: Clemens Ladisch
  Cc: Jaroslav Kysela, Takashi Iwai, Takashi Sakamoto, alsa-devel,
	linux-kernel, kernel-janitors

This code causes a static checker warning:

	sound/firewire/oxfw/oxfw.c:46 detect_loud_models()
	warn: signedness bug returning '(-2)'

The detect_loud_models() function should return false on falure, so that
we don't try to set up the loud code for hardware that doesn't support
it.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/sound/firewire/oxfw/oxfw.c b/sound/firewire/oxfw/oxfw.c
index cf1d0b5..60e5cad 100644
--- a/sound/firewire/oxfw/oxfw.c
+++ b/sound/firewire/oxfw/oxfw.c
@@ -43,7 +43,7 @@ static bool detect_loud_models(struct fw_unit *unit)
 	err = fw_csr_string(unit->directory, CSR_MODEL,
 			    model, sizeof(model));
 	if (err < 0)
-		return err;
+		return false;
 
 	for (i = 0; i < ARRAY_SIZE(models); i++) {
 		if (strcmp(models[i], model) == 0)

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [patch 2/2] ALSA: oxfw: fix detect_loud_models() return value
  2014-12-12 19:28 [patch 2/2] ALSA: oxfw: fix detect_loud_models() return value Dan Carpenter
@ 2014-12-13  4:45 ` Takashi Sakamoto
  2014-12-14 15:05   ` Takashi Iwai
  0 siblings, 1 reply; 3+ messages in thread
From: Takashi Sakamoto @ 2014-12-13  4:45 UTC (permalink / raw)
  To: Dan Carpenter, Clemens Ladisch
  Cc: Jaroslav Kysela, Takashi Iwai, alsa-devel, linux-kernel, kernel-janitors

On Dec 13 2014 04:28, Dan Carpenter wrote:
> This code causes a static checker warning:
> 
> 	sound/firewire/oxfw/oxfw.c:46 detect_loud_models()
> 	warn: signedness bug returning '(-2)'
> 
> The detect_loud_models() function should return false on falure, so that
> we don't try to set up the loud code for hardware that doesn't support
> it.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> diff --git a/sound/firewire/oxfw/oxfw.c b/sound/firewire/oxfw/oxfw.c
> index cf1d0b5..60e5cad 100644
> --- a/sound/firewire/oxfw/oxfw.c
> +++ b/sound/firewire/oxfw/oxfw.c
> @@ -43,7 +43,7 @@ static bool detect_loud_models(struct fw_unit *unit)
>  	err = fw_csr_string(unit->directory, CSR_MODEL,
>  			    model, sizeof(model));
>  	if (err < 0)
> -		return err;
> +		return false;
>  
>  	for (i = 0; i < ARRAY_SIZE(models); i++) {
>  		if (strcmp(models[i], model) == 0)

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


Thanks

Takashi Sakamoto
o-takashi@sakamocchi.jp

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [patch 2/2] ALSA: oxfw: fix detect_loud_models() return value
  2014-12-13  4:45 ` Takashi Sakamoto
@ 2014-12-14 15:05   ` Takashi Iwai
  0 siblings, 0 replies; 3+ messages in thread
From: Takashi Iwai @ 2014-12-14 15:05 UTC (permalink / raw)
  To: Takashi Sakamoto
  Cc: Dan Carpenter, Clemens Ladisch, Jaroslav Kysela, alsa-devel,
	linux-kernel, kernel-janitors

At Sat, 13 Dec 2014 13:45:55 +0900,
Takashi Sakamoto wrote:
> 
> On Dec 13 2014 04:28, Dan Carpenter wrote:
> > This code causes a static checker warning:
> > 
> > 	sound/firewire/oxfw/oxfw.c:46 detect_loud_models()
> > 	warn: signedness bug returning '(-2)'
> > 
> > The detect_loud_models() function should return false on falure, so that
> > we don't try to set up the loud code for hardware that doesn't support
> > it.
> > 
> > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> > 
> > diff --git a/sound/firewire/oxfw/oxfw.c b/sound/firewire/oxfw/oxfw.c
> > index cf1d0b5..60e5cad 100644
> > --- a/sound/firewire/oxfw/oxfw.c
> > +++ b/sound/firewire/oxfw/oxfw.c
> > @@ -43,7 +43,7 @@ static bool detect_loud_models(struct fw_unit *unit)
> >  	err = fw_csr_string(unit->directory, CSR_MODEL,
> >  			    model, sizeof(model));
> >  	if (err < 0)
> > -		return err;
> > +		return false;
> >  
> >  	for (i = 0; i < ARRAY_SIZE(models); i++) {
> >  		if (strcmp(models[i], model) == 0)
> 
> Reviewd-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>

Applied this one now.  Thanks.

(The second one is still pending, waiting for the final decision for a
 while.)


Takashi

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-12-14 15:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-12 19:28 [patch 2/2] ALSA: oxfw: fix detect_loud_models() return value Dan Carpenter
2014-12-13  4:45 ` Takashi Sakamoto
2014-12-14 15:05   ` Takashi Iwai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®