Showing error 1637

User: Jiri Slaby
Error type: Invalid Pointer Dereference
Error type description: A pointer which is invalid is being dereferenced
File location: drivers/media/video/cx18/cx18-i2c.c
Line in file: 106
Project: Linux Kernel
Project version: 2.6.28
Tools: Smatch (1.59)
Entered: 2013-09-10 07:54:05 UTC


Source:

 76        "gpio",
 77        "cx23418",
 78};
 79
 80int cx18_i2c_register(struct cx18 *cx, unsigned idx)
 81{
 82        struct i2c_board_info info;
 83        struct i2c_client *c;
 84        u8 id, bus;
 85        int i;
 86
 87        CX18_DEBUG_I2C("i2c client register\n");
 88        if (idx >= ARRAY_SIZE(hw_driverids) || hw_driverids[idx] == 0)
 89                return -1;
 90        id = hw_driverids[idx];
 91        bus = hw_bus[idx];
 92        memset(&info, 0, sizeof(info));
 93        strlcpy(info.type, hw_devicenames[idx], sizeof(info.type));
 94        info.addr = hw_addrs[idx];
 95        for (i = 0; i < I2C_CLIENTS_MAX; i++)
 96                if (cx->i2c_clients[i] == NULL)
 97                        break;
 98
 99        if (i == I2C_CLIENTS_MAX) {
100                CX18_ERR("insufficient room for new I2C client!\n");
101                return -ENOMEM;
102        }
103
104        if (id != I2C_DRIVERID_TUNER) {
105                c = i2c_new_device(&cx->i2c_adap[bus], &info);
106                if (c->driver == NULL)
107                        i2c_unregister_device(c);
108                else
109                        cx->i2c_clients[i] = c;
110                return cx->i2c_clients[i] ? 0 : -ENODEV;
111        }
112
113        /* special tuner handling */
114        c = i2c_new_probed_device(&cx->i2c_adap[1], &info, cx->card_i2c->radio);
115        if (c && c->driver == NULL)
116                i2c_unregister_device(c);
Show full sources