Showing error 922

User: Jiri Slaby
Error type: Leaving function in locked state
Error type description: Some lock is not unlocked on all paths of a function, so it is leaked
File location: drivers/hwmon/max6650.c
Line in file: 412
Project: Linux Kernel
Project version: 2.6.28
Confirmation: Fixed by 025dc740d01f99ccba945df1f9ef9e06b1c15d96
Tools: Stanse (1.2)
Entered: 2012-03-02 21:35:17 UTC


Source:

382{
383        struct max6650_data *data = max6650_update_device(dev);
384
385        return sprintf(buf, "%d\n", DIV_FROM_REG(data->count));
386}
387
388static ssize_t set_div(struct device *dev, struct device_attribute *devattr,
389                       const char *buf, size_t count)
390{
391        struct i2c_client *client = to_i2c_client(dev);
392        struct max6650_data *data = i2c_get_clientdata(client);
393        int div = simple_strtoul(buf, NULL, 10);
394
395        mutex_lock(&data->update_lock);
396        switch (div) {
397        case 1:
398                data->count = 0;
399                break;
400        case 2:
401                data->count = 1;
402                break;
403        case 4:
404                data->count = 2;
405                break;
406        case 8:
407                data->count = 3;
408                break;
409        default:
410                dev_err(&client->dev,
411                        "illegal value for fan divider (%d)\n", div);
412                return -EINVAL;
413        }
414
415        i2c_smbus_write_byte_data(client, MAX6650_REG_COUNT, data->count);
416        mutex_unlock(&data->update_lock);
417
418        return count;
419}
420
421static SENSOR_DEVICE_ATTR(fan1_input, S_IRUGO, get_fan, NULL, 0);
422static SENSOR_DEVICE_ATTR(fan2_input, S_IRUGO, get_fan, NULL, 1);
Show full sources