diff options
Diffstat (limited to 'drivers/mfd/menelaus.c')
-rw-r--r-- | drivers/mfd/menelaus.c | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/drivers/mfd/menelaus.c b/drivers/mfd/menelaus.c index 998ce8cb3065..ad25bfa3fb02 100644 --- a/drivers/mfd/menelaus.c +++ b/drivers/mfd/menelaus.c | |||
@@ -442,7 +442,7 @@ void menelaus_unregister_mmc_callback(void) | |||
442 | menelaus_remove_irq_work(MENELAUS_MMC_S2D1_IRQ); | 442 | menelaus_remove_irq_work(MENELAUS_MMC_S2D1_IRQ); |
443 | 443 | ||
444 | the_menelaus->mmc_callback = NULL; | 444 | the_menelaus->mmc_callback = NULL; |
445 | the_menelaus->mmc_callback_data = 0; | 445 | the_menelaus->mmc_callback_data = NULL; |
446 | } | 446 | } |
447 | EXPORT_SYMBOL(menelaus_unregister_mmc_callback); | 447 | EXPORT_SYMBOL(menelaus_unregister_mmc_callback); |
448 | 448 | ||
@@ -466,7 +466,7 @@ static int menelaus_set_voltage(const struct menelaus_vtg *vtg, int mV, | |||
466 | struct i2c_client *c = the_menelaus->client; | 466 | struct i2c_client *c = the_menelaus->client; |
467 | 467 | ||
468 | mutex_lock(&the_menelaus->lock); | 468 | mutex_lock(&the_menelaus->lock); |
469 | if (vtg == 0) | 469 | if (!vtg) |
470 | goto set_voltage; | 470 | goto set_voltage; |
471 | 471 | ||
472 | ret = menelaus_read_reg(vtg->vtg_reg); | 472 | ret = menelaus_read_reg(vtg->vtg_reg); |
@@ -1189,7 +1189,7 @@ static int menelaus_probe(struct i2c_client *client, | |||
1189 | int rev = 0, val; | 1189 | int rev = 0, val; |
1190 | int err = 0; | 1190 | int err = 0; |
1191 | struct menelaus_platform_data *menelaus_pdata = | 1191 | struct menelaus_platform_data *menelaus_pdata = |
1192 | client->dev.platform_data; | 1192 | dev_get_platdata(&client->dev); |
1193 | 1193 | ||
1194 | if (the_menelaus) { | 1194 | if (the_menelaus) { |
1195 | dev_dbg(&client->dev, "only one %s for now\n", | 1195 | dev_dbg(&client->dev, "only one %s for now\n", |
@@ -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; |
1260 | fail2: | 1259 | fail: |
1261 | free_irq(client->irq, menelaus); | 1260 | free_irq(client->irq, menelaus); |
1262 | flush_work(&menelaus->work); | 1261 | flush_work(&menelaus->work); |
1263 | fail1: | ||
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 | } |