summaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/pmbus/lm25066.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/hwmon/pmbus/lm25066.c')
-rw-r--r--drivers/hwmon/pmbus/lm25066.c26
1 files changed, 6 insertions, 20 deletions
diff --git a/drivers/hwmon/pmbus/lm25066.c b/drivers/hwmon/pmbus/lm25066.c
index 86ac15ade6ab..e70d4ca14fbe 100644
--- a/drivers/hwmon/pmbus/lm25066.c
+++ b/drivers/hwmon/pmbus/lm25066.c
@@ -176,7 +176,6 @@ static int lm25066_probe(struct i2c_client *client,
const struct i2c_device_id *id)
{
int config;
- int ret;
struct lm25066_data *data;
struct pmbus_driver_info *info;
@@ -184,15 +183,14 @@ static int lm25066_probe(struct i2c_client *client,
I2C_FUNC_SMBUS_READ_BYTE_DATA))
return -ENODEV;
- data = kzalloc(sizeof(struct lm25066_data), GFP_KERNEL);
+ data = devm_kzalloc(&client->dev, sizeof(struct lm25066_data),
+ GFP_KERNEL);
if (!data)
return -ENOMEM;
config = i2c_smbus_read_byte_data(client, LM25066_DEVICE_SETUP);
- if (config < 0) {
- ret = config;
- goto err_mem;
- }
+ if (config < 0)
+ return config;
data->id = id->driver_data;
info = &data->info;
@@ -291,27 +289,15 @@ static int lm25066_probe(struct i2c_client *client,
}
break;
default:
- ret = -ENODEV;
- goto err_mem;
+ return -ENODEV;
}
- ret = pmbus_do_probe(client, id, info);
- if (ret)
- goto err_mem;
- return 0;
-
-err_mem:
- kfree(data);
- return ret;
+ return pmbus_do_probe(client, id, info);
}
static int lm25066_remove(struct i2c_client *client)
{
- const struct pmbus_driver_info *info = pmbus_get_driver_info(client);
- const struct lm25066_data *data = to_lm25066_data(info);
-
pmbus_do_remove(client);
- kfree(data);
return 0;
}
OpenPOWER on IntegriCloud