aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKeerthy <j-keerthy@ti.com>2018-12-09 08:59:31 -0500
committerLee Jones <lee.jones@linaro.org>2019-01-03 03:32:42 -0500
commit75d4c5e03c2ae9902ab521024b10291f6fc9515b (patch)
tree181491178b4792f0ab88a3950f75af940bf2545d
parent38df91cc0b82d053234accf4429eafd2f5a4d401 (diff)
mfd: tps65218: Use devm_regmap_add_irq_chip and clean up error path in probe()
Use devm_regmap_add_irq_chip and clean up error path in probe and also the remove function. Reported-by: Christian Hohnstaedt <Christian.Hohnstaedt@wago.com> Signed-off-by: Keerthy <j-keerthy@ti.com> Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
-rw-r--r--drivers/mfd/tps65218.c24
1 files changed, 3 insertions, 21 deletions
diff --git a/drivers/mfd/tps65218.c b/drivers/mfd/tps65218.c
index 910f569ff77c..8bcdecf494d0 100644
--- a/drivers/mfd/tps65218.c
+++ b/drivers/mfd/tps65218.c
@@ -235,9 +235,9 @@ static int tps65218_probe(struct i2c_client *client,
235 235
236 mutex_init(&tps->tps_lock); 236 mutex_init(&tps->tps_lock);
237 237
238 ret = regmap_add_irq_chip(tps->regmap, tps->irq, 238 ret = devm_regmap_add_irq_chip(&client->dev, tps->regmap, tps->irq,
239 IRQF_ONESHOT, 0, &tps65218_irq_chip, 239 IRQF_ONESHOT, 0, &tps65218_irq_chip,
240 &tps->irq_data); 240 &tps->irq_data);
241 if (ret < 0) 241 if (ret < 0)
242 return ret; 242 return ret;
243 243
@@ -253,26 +253,9 @@ static int tps65218_probe(struct i2c_client *client,
253 ARRAY_SIZE(tps65218_cells), NULL, 0, 253 ARRAY_SIZE(tps65218_cells), NULL, 0,
254 regmap_irq_get_domain(tps->irq_data)); 254 regmap_irq_get_domain(tps->irq_data));
255 255
256 if (ret < 0)
257 goto err_irq;
258
259 return 0;
260
261err_irq:
262 regmap_del_irq_chip(tps->irq, tps->irq_data);
263
264 return ret; 256 return ret;
265} 257}
266 258
267static int tps65218_remove(struct i2c_client *client)
268{
269 struct tps65218 *tps = i2c_get_clientdata(client);
270
271 regmap_del_irq_chip(tps->irq, tps->irq_data);
272
273 return 0;
274}
275
276static const struct i2c_device_id tps65218_id_table[] = { 259static const struct i2c_device_id tps65218_id_table[] = {
277 { "tps65218", TPS65218 }, 260 { "tps65218", TPS65218 },
278 { }, 261 { },
@@ -285,7 +268,6 @@ static struct i2c_driver tps65218_driver = {
285 .of_match_table = of_tps65218_match_table, 268 .of_match_table = of_tps65218_match_table,
286 }, 269 },
287 .probe = tps65218_probe, 270 .probe = tps65218_probe,
288 .remove = tps65218_remove,
289 .id_table = tps65218_id_table, 271 .id_table = tps65218_id_table,
290}; 272};
291 273