Skip to contentSkip to conversation

si2165: Add demod driver for DVB-T only

media Dan Carpenter 2 participants 2 messages Aug 1, 2014 – Aug 2, 2014 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

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

#1 lore raw
Quoted 2 lines · Dan Carpenter

Hello Matthias Schwarzott,

Hello Dan,

Quoted 19 lines

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;
Quoted 1 line

This is the success path?

yes it is.

Quoted 8 lines
   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