aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/adm1275.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/hwmon/adm1275.c')
-rw-r--r--drivers/hwmon/adm1275.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/drivers/hwmon/adm1275.c b/drivers/hwmon/adm1275.c
index c2ee2048ab91..b9b7caf4a1d2 100644
--- a/drivers/hwmon/adm1275.c
+++ b/drivers/hwmon/adm1275.c
@@ -32,6 +32,7 @@ static int adm1275_probe(struct i2c_client *client,
32 const struct i2c_device_id *id) 32 const struct i2c_device_id *id)
33{ 33{
34 int config; 34 int config;
35 int ret;
35 struct pmbus_driver_info *info; 36 struct pmbus_driver_info *info;
36 37
37 if (!i2c_check_functionality(client->adapter, 38 if (!i2c_check_functionality(client->adapter,
@@ -43,8 +44,10 @@ static int adm1275_probe(struct i2c_client *client,
43 return -ENOMEM; 44 return -ENOMEM;
44 45
45 config = i2c_smbus_read_byte_data(client, ADM1275_PMON_CONFIG); 46 config = i2c_smbus_read_byte_data(client, ADM1275_PMON_CONFIG);
46 if (config < 0) 47 if (config < 0) {
47 return config; 48 ret = config;
49 goto err_mem;
50 }
48 51
49 info->pages = 1; 52 info->pages = 1;
50 info->direct[PSC_VOLTAGE_IN] = true; 53 info->direct[PSC_VOLTAGE_IN] = true;
@@ -76,7 +79,14 @@ static int adm1275_probe(struct i2c_client *client,
76 else 79 else
77 info->func[0] |= PMBUS_HAVE_VIN | PMBUS_HAVE_STATUS_INPUT; 80 info->func[0] |= PMBUS_HAVE_VIN | PMBUS_HAVE_STATUS_INPUT;
78 81
79 return pmbus_do_probe(client, id, info); 82 ret = pmbus_do_probe(client, id, info);
83 if (ret)
84 goto err_mem;
85 return 0;
86
87err_mem:
88 kfree(info);
89 return ret;
80} 90}
81 91
82static int adm1275_remove(struct i2c_client *client) 92static int adm1275_remove(struct i2c_client *client)