aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/pmbus/ucd9200.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/hwmon/pmbus/ucd9200.c')
-rw-r--r--drivers/hwmon/pmbus/ucd9200.c22
1 files changed, 6 insertions, 16 deletions
diff --git a/drivers/hwmon/pmbus/ucd9200.c b/drivers/hwmon/pmbus/ucd9200.c
index 629d0c93cac6..c0d41b993a53 100644
--- a/drivers/hwmon/pmbus/ucd9200.c
+++ b/drivers/hwmon/pmbus/ucd9200.c
@@ -81,7 +81,8 @@ static int ucd9200_probe(struct i2c_client *client,
81 "Device mismatch: Configured %s, detected %s\n", 81 "Device mismatch: Configured %s, detected %s\n",
82 id->name, mid->name); 82 id->name, mid->name);
83 83
84 info = kzalloc(sizeof(struct pmbus_driver_info), GFP_KERNEL); 84 info = devm_kzalloc(&client->dev, sizeof(struct pmbus_driver_info),
85 GFP_KERNEL);
85 if (!info) 86 if (!info)
86 return -ENOMEM; 87 return -ENOMEM;
87 88
@@ -89,7 +90,7 @@ static int ucd9200_probe(struct i2c_client *client,
89 block_buffer); 90 block_buffer);
90 if (ret < 0) { 91 if (ret < 0) {
91 dev_err(&client->dev, "Failed to read phase information\n"); 92 dev_err(&client->dev, "Failed to read phase information\n");
92 goto out; 93 return ret;
93 } 94 }
94 95
95 /* 96 /*
@@ -106,8 +107,7 @@ static int ucd9200_probe(struct i2c_client *client,
106 } 107 }
107 if (!info->pages) { 108 if (!info->pages) {
108 dev_err(&client->dev, "No rails configured\n"); 109 dev_err(&client->dev, "No rails configured\n");
109 ret = -ENODEV; 110 return -ENODEV;
110 goto out;
111 } 111 }
112 dev_info(&client->dev, "%d rails configured\n", info->pages); 112 dev_info(&client->dev, "%d rails configured\n", info->pages);
113 113
@@ -137,7 +137,7 @@ static int ucd9200_probe(struct i2c_client *client,
137 if (ret < 0) { 137 if (ret < 0) {
138 dev_err(&client->dev, 138 dev_err(&client->dev,
139 "Failed to initialize PHASE registers\n"); 139 "Failed to initialize PHASE registers\n");
140 goto out; 140 return ret;
141 } 141 }
142 } 142 }
143 if (info->pages > 1) 143 if (info->pages > 1)
@@ -160,22 +160,12 @@ static int ucd9200_probe(struct i2c_client *client,
160 if (mid->driver_data == ucd9240) 160 if (mid->driver_data == ucd9240)
161 info->func[0] |= PMBUS_HAVE_FAN12 | PMBUS_HAVE_STATUS_FAN12; 161 info->func[0] |= PMBUS_HAVE_FAN12 | PMBUS_HAVE_STATUS_FAN12;
162 162
163 ret = pmbus_do_probe(client, mid, info); 163 return pmbus_do_probe(client, mid, info);
164 if (ret < 0)
165 goto out;
166 return 0;
167out:
168 kfree(info);
169 return ret;
170} 164}
171 165
172static int ucd9200_remove(struct i2c_client *client) 166static int ucd9200_remove(struct i2c_client *client)
173{ 167{
174 const struct pmbus_driver_info *info;
175
176 info = pmbus_get_driver_info(client);
177 pmbus_do_remove(client); 168 pmbus_do_remove(client);
178 kfree(info);
179 return 0; 169 return 0;
180} 170}
181 171