Skip to contentSkip to conversation

drivers/media/pci/saa7134/saa7134-input.c: is variable b really uninitialized in line 136 ?

DISCUSSION Toralf Förster 1 participant 1 message Jul 6, 2014 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

/me wonders if cppcheck is right here :

static int get_key_flydvb_trio(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw)

{
        int gpio;
        int attempt = 0;
        unsigned char b;

        /* We need this to access GPI Used by the saa_readl macro. */
        struct saa7134_dev *dev = ir->c->adapter->algo_data;

        if (dev == NULL) {
                i2cdprintk("get_key_flydvb_trio: "
                           "ir->c->adapter->algo_data is NULL!\n");
                return -EIO;
        }

        /* rising SAA7134_GPIGPRESCAN reads the status */
        saa_clearb(SAA7134_GPIO_GPMODE3, SAA7134_GPIO_GPRESCAN);
        saa_setb(SAA7134_GPIO_GPMODE3, SAA7134_GPIO_GPRESCAN);

        gpio = saa_readl(SAA7134_GPIO_GPSTATUS0 >> 2);

        if (0x40000 & ~gpio)
                return 0; /* No button press */

        /* No button press - only before first key pressed */
        if (b == 0xFF)                                                           <--- Uninitialized variable: b
                return 0;

        /* poll IR chip */
        /* weak up the IR chip */
        b = 0;
Signature · 1 line
Toralf