Showing error 1719

User: Jiri Slaby
Error type: Invalid Pointer Dereference
Error type description: A pointer which is invalid is being dereferenced
File location: drivers/hwmon/lm75.c
Line in file: 101
Project: Linux Kernel
Project version: 2.6.28
Tools: Smatch (1.59)
Entered: 2013-09-10 20:24:52 UTC


Source:

 71};
 72
 73/* Each client has this additional data */
 74struct lm75_data {
 75        struct device                *hwmon_dev;
 76        struct mutex                update_lock;
 77        u8                        orig_conf;
 78        char                        valid;                /* !=0 if registers are valid */
 79        unsigned long                last_updated;        /* In jiffies */
 80        u16                        temp[3];        /* Register values,
 81                                                   0 = input
 82                                                   1 = max
 83                                                   2 = hyst */
 84};
 85
 86static int lm75_read_value(struct i2c_client *client, u8 reg);
 87static int lm75_write_value(struct i2c_client *client, u8 reg, u16 value);
 88static struct lm75_data *lm75_update_device(struct device *dev);
 89
 90
 91/*-----------------------------------------------------------------------*/
 92
 93/* sysfs attributes for hwmon */
 94
 95static ssize_t show_temp(struct device *dev, struct device_attribute *da,
 96                         char *buf)
 97{
 98        struct sensor_device_attribute *attr = to_sensor_dev_attr(da);
 99        struct lm75_data *data = lm75_update_device(dev);
100        return sprintf(buf, "%d\n",
101                       LM75_TEMP_FROM_REG(data->temp[attr->index]));
102}
103
104static ssize_t set_temp(struct device *dev, struct device_attribute *da,
105                        const char *buf, size_t count)
106{
107        struct sensor_device_attribute *attr = to_sensor_dev_attr(da);
108        struct i2c_client *client = to_i2c_client(dev);
109        struct lm75_data *data = i2c_get_clientdata(client);
110        int nr = attr->index;
111        long temp = simple_strtol(buf, NULL, 10);
Show full sources