diff options
-rw-r--r-- | drivers/hwmon/lm75.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/drivers/hwmon/lm75.c b/drivers/hwmon/lm75.c index a83f206af244..291edfff55bf 100644 --- a/drivers/hwmon/lm75.c +++ b/drivers/hwmon/lm75.c | |||
@@ -156,7 +156,7 @@ lm75_probe(struct i2c_client *client, const struct i2c_device_id *id) | |||
156 | I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_WORD_DATA)) | 156 | I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_WORD_DATA)) |
157 | return -EIO; | 157 | return -EIO; |
158 | 158 | ||
159 | data = kzalloc(sizeof(struct lm75_data), GFP_KERNEL); | 159 | data = devm_kzalloc(&client->dev, sizeof(struct lm75_data), GFP_KERNEL); |
160 | if (!data) | 160 | if (!data) |
161 | return -ENOMEM; | 161 | return -ENOMEM; |
162 | 162 | ||
@@ -174,7 +174,7 @@ lm75_probe(struct i2c_client *client, const struct i2c_device_id *id) | |||
174 | status = lm75_read_value(client, LM75_REG_CONF); | 174 | status = lm75_read_value(client, LM75_REG_CONF); |
175 | if (status < 0) { | 175 | if (status < 0) { |
176 | dev_dbg(&client->dev, "Can't read config? %d\n", status); | 176 | dev_dbg(&client->dev, "Can't read config? %d\n", status); |
177 | goto exit_free; | 177 | return status; |
178 | } | 178 | } |
179 | data->orig_conf = status; | 179 | data->orig_conf = status; |
180 | new = status & ~clr_mask; | 180 | new = status & ~clr_mask; |
@@ -186,7 +186,7 @@ lm75_probe(struct i2c_client *client, const struct i2c_device_id *id) | |||
186 | /* Register sysfs hooks */ | 186 | /* Register sysfs hooks */ |
187 | status = sysfs_create_group(&client->dev.kobj, &lm75_group); | 187 | status = sysfs_create_group(&client->dev.kobj, &lm75_group); |
188 | if (status) | 188 | if (status) |
189 | goto exit_free; | 189 | return status; |
190 | 190 | ||
191 | data->hwmon_dev = hwmon_device_register(&client->dev); | 191 | data->hwmon_dev = hwmon_device_register(&client->dev); |
192 | if (IS_ERR(data->hwmon_dev)) { | 192 | if (IS_ERR(data->hwmon_dev)) { |
@@ -201,8 +201,6 @@ lm75_probe(struct i2c_client *client, const struct i2c_device_id *id) | |||
201 | 201 | ||
202 | exit_remove: | 202 | exit_remove: |
203 | sysfs_remove_group(&client->dev.kobj, &lm75_group); | 203 | sysfs_remove_group(&client->dev.kobj, &lm75_group); |
204 | exit_free: | ||
205 | kfree(data); | ||
206 | return status; | 204 | return status; |
207 | } | 205 | } |
208 | 206 | ||
@@ -213,7 +211,6 @@ static int lm75_remove(struct i2c_client *client) | |||
213 | hwmon_device_unregister(data->hwmon_dev); | 211 | hwmon_device_unregister(data->hwmon_dev); |
214 | sysfs_remove_group(&client->dev.kobj, &lm75_group); | 212 | sysfs_remove_group(&client->dev.kobj, &lm75_group); |
215 | lm75_write_value(client, LM75_REG_CONF, data->orig_conf); | 213 | lm75_write_value(client, LM75_REG_CONF, data->orig_conf); |
216 | kfree(data); | ||
217 | return 0; | 214 | return 0; |
218 | } | 215 | } |
219 | 216 | ||