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.c26
1 files changed, 18 insertions, 8 deletions
diff --git a/drivers/hwmon/adm1275.c b/drivers/hwmon/adm1275.c
index c2ee2048ab91..8bc1bd663721 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,30 +44,32 @@ 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;
51 info->direct[PSC_VOLTAGE_OUT] = true; 54 info->direct[PSC_VOLTAGE_OUT] = true;
52 info->direct[PSC_CURRENT_OUT] = true; 55 info->direct[PSC_CURRENT_OUT] = true;
53 info->m[PSC_CURRENT_OUT] = 800; 56 info->m[PSC_CURRENT_OUT] = 807;
54 info->b[PSC_CURRENT_OUT] = 20475; 57 info->b[PSC_CURRENT_OUT] = 20475;
55 info->R[PSC_CURRENT_OUT] = -1; 58 info->R[PSC_CURRENT_OUT] = -1;
56 info->func[0] = PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT; 59 info->func[0] = PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT;
57 60
58 if (config & ADM1275_VRANGE) { 61 if (config & ADM1275_VRANGE) {
59 info->m[PSC_VOLTAGE_IN] = 19045; 62 info->m[PSC_VOLTAGE_IN] = 19199;
60 info->b[PSC_VOLTAGE_IN] = 0; 63 info->b[PSC_VOLTAGE_IN] = 0;
61 info->R[PSC_VOLTAGE_IN] = -2; 64 info->R[PSC_VOLTAGE_IN] = -2;
62 info->m[PSC_VOLTAGE_OUT] = 19045; 65 info->m[PSC_VOLTAGE_OUT] = 19199;
63 info->b[PSC_VOLTAGE_OUT] = 0; 66 info->b[PSC_VOLTAGE_OUT] = 0;
64 info->R[PSC_VOLTAGE_OUT] = -2; 67 info->R[PSC_VOLTAGE_OUT] = -2;
65 } else { 68 } else {
66 info->m[PSC_VOLTAGE_IN] = 6666; 69 info->m[PSC_VOLTAGE_IN] = 6720;
67 info->b[PSC_VOLTAGE_IN] = 0; 70 info->b[PSC_VOLTAGE_IN] = 0;
68 info->R[PSC_VOLTAGE_IN] = -1; 71 info->R[PSC_VOLTAGE_IN] = -1;
69 info->m[PSC_VOLTAGE_OUT] = 6666; 72 info->m[PSC_VOLTAGE_OUT] = 6720;
70 info->b[PSC_VOLTAGE_OUT] = 0; 73 info->b[PSC_VOLTAGE_OUT] = 0;
71 info->R[PSC_VOLTAGE_OUT] = -1; 74 info->R[PSC_VOLTAGE_OUT] = -1;
72 } 75 }
@@ -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)