All of lore.kernel.org
 help / color / mirror / Atom feed
* re: [media] si2165: Add demod driver for DVB-T only
@ 2014-08-01 15:23 Dan Carpenter
  2014-08-02 12:37 ` Matthias Schwarzott
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2014-08-01 15:23 UTC (permalink / raw)
  To: zzam; +Cc: Matthias Schwarzott, linux-media

Hello Matthias Schwarzott,

The patch 3e54a1697ace: "[media] si2165: Add demod driver for DVB-T
only" from Jul 22, 2014, leads to the following static checker
warning:

	drivers/media/dvb-frontends/si2165.c:329 si2165_wait_init_done()
	warn: signedness bug returning '(-22)'

drivers/media/dvb-frontends/si2165.c
   315  static bool si2165_wait_init_done(struct si2165_state *state)
   316  {
   317          int ret = -EINVAL;
   318          u8 val = 0;
   319          int i;
   320  
   321          for (i = 0; i < 3; ++i) {
   322                  si2165_readreg8(state, 0x0054, &val);
   323                  if (val == 0x01)
   324                          return 0;

This is the success path?

   325                  usleep_range(1000, 50000);
   326          }
   327          dev_err(&state->i2c->dev, "%s: init_done was not set\n",
   328                  KBUILD_MODNAME);
   329          return ret;

-EINVAL becomes 1 when casted to bool.

   330  }

regards,
dan carpenter

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

* Re: [media] si2165: Add demod driver for DVB-T only
  2014-08-01 15:23 [media] si2165: Add demod driver for DVB-T only Dan Carpenter
@ 2014-08-02 12:37 ` Matthias Schwarzott
  0 siblings, 0 replies; 2+ messages in thread
From: Matthias Schwarzott @ 2014-08-02 12:37 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: linux-media

On 01.08.2014 17:23, Dan Carpenter wrote:
> Hello Matthias Schwarzott,
> 
Hello Dan,

> The patch 3e54a1697ace: "[media] si2165: Add demod driver for DVB-T
> only" from Jul 22, 2014, leads to the following static checker
> warning:
> 
> 	drivers/media/dvb-frontends/si2165.c:329 si2165_wait_init_done()
> 	warn: signedness bug returning '(-22)'
> 
> drivers/media/dvb-frontends/si2165.c
>    315  static bool si2165_wait_init_done(struct si2165_state *state)
>    316  {
>    317          int ret = -EINVAL;
>    318          u8 val = 0;
>    319          int i;
>    320  
>    321          for (i = 0; i < 3; ++i) {
>    322                  si2165_readreg8(state, 0x0054, &val);
>    323                  if (val == 0x01)
>    324                          return 0;
> 
> This is the success path?
yes it is.

> 
>    325                  usleep_range(1000, 50000);
>    326          }
>    327          dev_err(&state->i2c->dev, "%s: init_done was not set\n",
>    328                  KBUILD_MODNAME);
>    329          return ret;
> 
> -EINVAL becomes 1 when casted to bool.

I already noticed this and prepared a patch to change the return type to
int.

This will be sent the next days.

Regards
Matthias


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

end of thread, other threads:[~2014-08-02 12:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-01 15:23 [media] si2165: Add demod driver for DVB-T only Dan Carpenter
2014-08-02 12:37 ` Matthias Schwarzott

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.