x86/bugs: Drop one "mitigation" from dmesg
[pandora-kernel.git] / drivers / hwmon / ads1015.c
index eedca3c..2f14cad 100644 (file)
@@ -186,7 +186,7 @@ static int ads1015_get_channels_config_of(struct i2c_client *client)
                }
 
                channel = be32_to_cpup(property);
-               if (channel > ADS1015_CHANNELS) {
+               if (channel >= ADS1015_CHANNELS) {
                        dev_err(&client->dev,
                                "invalid channel index %d on %s\n",
                                channel, node->full_name);
@@ -200,6 +200,7 @@ static int ads1015_get_channels_config_of(struct i2c_client *client)
                                dev_err(&client->dev,
                                        "invalid gain on %s\n",
                                        node->full_name);
+                               return -EINVAL;
                        }
                }
 
@@ -210,6 +211,7 @@ static int ads1015_get_channels_config_of(struct i2c_client *client)
                                dev_err(&client->dev,
                                        "invalid data_rate on %s\n",
                                        node->full_name);
+                               return -EINVAL;
                        }
                }
 
@@ -271,7 +273,7 @@ static int ads1015_probe(struct i2c_client *client,
                        continue;
                err = device_create_file(&client->dev, &ads1015_in[k].dev_attr);
                if (err)
-                       goto exit_free;
+                       goto exit_remove;
        }
 
        data->hwmon_dev = hwmon_device_register(&client->dev);
@@ -285,7 +287,6 @@ static int ads1015_probe(struct i2c_client *client,
 exit_remove:
        for (k = 0; k < ADS1015_CHANNELS; ++k)
                device_remove_file(&client->dev, &ads1015_in[k].dev_attr);
-exit_free:
        kfree(data);
 exit:
        return err;