aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mfd/tps6105x.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mfd/tps6105x.c')
-rw-r--r--drivers/mfd/tps6105x.c17
1 files changed, 4 insertions, 13 deletions
diff --git a/drivers/mfd/tps6105x.c b/drivers/mfd/tps6105x.c
index b5dfa6e4e692..5de95c265c1a 100644
--- a/drivers/mfd/tps6105x.c
+++ b/drivers/mfd/tps6105x.c
@@ -141,7 +141,7 @@ static int tps6105x_probe(struct i2c_client *client,
141 int ret; 141 int ret;
142 int i; 142 int i;
143 143
144 tps6105x = kmalloc(sizeof(*tps6105x), GFP_KERNEL); 144 tps6105x = devm_kmalloc(&client->dev, sizeof(*tps6105x), GFP_KERNEL);
145 if (!tps6105x) 145 if (!tps6105x)
146 return -ENOMEM; 146 return -ENOMEM;
147 147
@@ -154,7 +154,7 @@ static int tps6105x_probe(struct i2c_client *client,
154 ret = tps6105x_startup(tps6105x); 154 ret = tps6105x_startup(tps6105x);
155 if (ret) { 155 if (ret) {
156 dev_err(&client->dev, "chip initialization failed\n"); 156 dev_err(&client->dev, "chip initialization failed\n");
157 goto fail; 157 return ret;
158 } 158 }
159 159
160 /* Remove warning texts when you implement new cell drivers */ 160 /* Remove warning texts when you implement new cell drivers */
@@ -187,16 +187,8 @@ static int tps6105x_probe(struct i2c_client *client,
187 tps6105x_cells[i].pdata_size = sizeof(*tps6105x); 187 tps6105x_cells[i].pdata_size = sizeof(*tps6105x);
188 } 188 }
189 189
190 ret = mfd_add_devices(&client->dev, 0, tps6105x_cells, 190 return mfd_add_devices(&client->dev, 0, tps6105x_cells,
191 ARRAY_SIZE(tps6105x_cells), NULL, 0, NULL); 191 ARRAY_SIZE(tps6105x_cells), NULL, 0, NULL);
192 if (ret)
193 goto fail;
194
195 return 0;
196
197fail:
198 kfree(tps6105x);
199 return ret;
200} 192}
201 193
202static int tps6105x_remove(struct i2c_client *client) 194static int tps6105x_remove(struct i2c_client *client)
@@ -210,7 +202,6 @@ static int tps6105x_remove(struct i2c_client *client)
210 TPS6105X_REG0_MODE_MASK, 202 TPS6105X_REG0_MODE_MASK,
211 TPS6105X_MODE_SHUTDOWN << TPS6105X_REG0_MODE_SHIFT); 203 TPS6105X_MODE_SHUTDOWN << TPS6105X_REG0_MODE_SHIFT);
212 204
213 kfree(tps6105x);
214 return 0; 205 return 0;
215} 206}
216 207