aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mfd
diff options
context:
space:
mode:
authorJingoo Han <jg1.han@samsung.com>2013-08-20 03:05:11 -0400
committerLee Jones <lee.jones@linaro.org>2013-08-20 03:51:32 -0400
commit7a4043112778c8ba7169b3006c8b7789213c878a (patch)
treed6fbf8729f4d141d49a7a0e8ea1af37ab6f15eb4 /drivers/mfd
parent0010dd3883b8a5e99c7d4093b97e9e34300a2f03 (diff)
mfd: menelaus: Use devm_*() functions
Use devm_*() functions to make cleanup paths simpler. Signed-off-by: Jingoo Han <jg1.han@samsung.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
Diffstat (limited to 'drivers/mfd')
-rw-r--r--drivers/mfd/menelaus.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/drivers/mfd/menelaus.c b/drivers/mfd/menelaus.c
index f24df8c9b02e..ad25bfa3fb02 100644
--- a/drivers/mfd/menelaus.c
+++ b/drivers/mfd/menelaus.c
@@ -1197,7 +1197,7 @@ static int menelaus_probe(struct i2c_client *client,
1197 return -ENODEV; 1197 return -ENODEV;
1198 } 1198 }
1199 1199
1200 menelaus = kzalloc(sizeof *menelaus, GFP_KERNEL); 1200 menelaus = devm_kzalloc(&client->dev, sizeof(*menelaus), GFP_KERNEL);
1201 if (!menelaus) 1201 if (!menelaus)
1202 return -ENOMEM; 1202 return -ENOMEM;
1203 1203
@@ -1210,8 +1210,7 @@ static int menelaus_probe(struct i2c_client *client,
1210 rev = menelaus_read_reg(MENELAUS_REV); 1210 rev = menelaus_read_reg(MENELAUS_REV);
1211 if (rev < 0) { 1211 if (rev < 0) {
1212 pr_err(DRIVER_NAME ": device not found"); 1212 pr_err(DRIVER_NAME ": device not found");
1213 err = -ENODEV; 1213 return -ENODEV;
1214 goto fail1;
1215 } 1214 }
1216 1215
1217 /* Ack and disable all Menelaus interrupts */ 1216 /* Ack and disable all Menelaus interrupts */
@@ -1231,7 +1230,7 @@ static int menelaus_probe(struct i2c_client *client,
1231 if (err) { 1230 if (err) {
1232 dev_dbg(&client->dev, "can't get IRQ %d, err %d\n", 1231 dev_dbg(&client->dev, "can't get IRQ %d, err %d\n",
1233 client->irq, err); 1232 client->irq, err);
1234 goto fail1; 1233 return err;
1235 } 1234 }
1236 } 1235 }
1237 1236
@@ -1242,7 +1241,7 @@ static int menelaus_probe(struct i2c_client *client,
1242 1241
1243 val = menelaus_read_reg(MENELAUS_VCORE_CTRL1); 1242 val = menelaus_read_reg(MENELAUS_VCORE_CTRL1);
1244 if (val < 0) 1243 if (val < 0)
1245 goto fail2; 1244 goto fail;
1246 if (val & (1 << 7)) 1245 if (val & (1 << 7))
1247 menelaus->vcore_hw_mode = 1; 1246 menelaus->vcore_hw_mode = 1;
1248 else 1247 else
@@ -1251,17 +1250,15 @@ static int menelaus_probe(struct i2c_client *client,
1251 if (menelaus_pdata != NULL && menelaus_pdata->late_init != NULL) { 1250 if (menelaus_pdata != NULL && menelaus_pdata->late_init != NULL) {
1252 err = menelaus_pdata->late_init(&client->dev); 1251 err = menelaus_pdata->late_init(&client->dev);
1253 if (err < 0) 1252 if (err < 0)
1254 goto fail2; 1253 goto fail;
1255 } 1254 }
1256 1255
1257 menelaus_rtc_init(menelaus); 1256 menelaus_rtc_init(menelaus);
1258 1257
1259 return 0; 1258 return 0;
1260fail2: 1259fail:
1261 free_irq(client->irq, menelaus); 1260 free_irq(client->irq, menelaus);
1262 flush_work(&menelaus->work); 1261 flush_work(&menelaus->work);
1263fail1:
1264 kfree(menelaus);
1265 return err; 1262 return err;
1266} 1263}
1267 1264
@@ -1271,7 +1268,6 @@ static int __exit menelaus_remove(struct i2c_client *client)
1271 1268
1272 free_irq(client->irq, menelaus); 1269 free_irq(client->irq, menelaus);
1273 flush_work(&menelaus->work); 1270 flush_work(&menelaus->work);
1274 kfree(menelaus);
1275 the_menelaus = NULL; 1271 the_menelaus = NULL;
1276 return 0; 1272 return 0;
1277} 1273}