Commit 19a8da2187249c02574ccffaf72637eb224d11c4
Committed by
Mark Brown
1 parent
9a4bdd87a2
Exists in
smarc-l5.0.0_1.0.0-ga
and in
5 other branches
regulator: tps65023: Use devm_* APIs
Signed-off-by: Axel Lin <axel.lin@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Showing 1 changed file with 3 additions and 11 deletions Side-by-side Diff
drivers/regulator/tps65023-regulator.c
... | ... | @@ -394,16 +394,16 @@ |
394 | 394 | if (!init_data) |
395 | 395 | return -EIO; |
396 | 396 | |
397 | - tps = kzalloc(sizeof(*tps), GFP_KERNEL); | |
397 | + tps = devm_kzalloc(&client->dev, sizeof(*tps), GFP_KERNEL); | |
398 | 398 | if (!tps) |
399 | 399 | return -ENOMEM; |
400 | 400 | |
401 | - tps->regmap = regmap_init_i2c(client, &tps65023_regmap_config); | |
401 | + tps->regmap = devm_regmap_init_i2c(client, &tps65023_regmap_config); | |
402 | 402 | if (IS_ERR(tps->regmap)) { |
403 | 403 | error = PTR_ERR(tps->regmap); |
404 | 404 | dev_err(&client->dev, "Failed to allocate register map: %d\n", |
405 | 405 | error); |
406 | - goto fail_alloc; | |
406 | + return error; | |
407 | 407 | } |
408 | 408 | |
409 | 409 | /* common for all regulators */ |
... | ... | @@ -449,10 +449,6 @@ |
449 | 449 | fail: |
450 | 450 | while (--i >= 0) |
451 | 451 | regulator_unregister(tps->rdev[i]); |
452 | - | |
453 | - regmap_exit(tps->regmap); | |
454 | - fail_alloc: | |
455 | - kfree(tps); | |
456 | 452 | return error; |
457 | 453 | } |
458 | 454 | |
... | ... | @@ -463,10 +459,6 @@ |
463 | 459 | |
464 | 460 | for (i = 0; i < TPS65023_NUM_REGULATOR; i++) |
465 | 461 | regulator_unregister(tps->rdev[i]); |
466 | - | |
467 | - regmap_exit(tps->regmap); | |
468 | - kfree(tps); | |
469 | - | |
470 | 462 | return 0; |
471 | 463 | } |
472 | 464 |