diff options
author | Axel Lin <axel.lin@ingics.com> | 2014-06-15 21:44:20 -0400 |
---|---|---|
committer | Mark Brown <broonie@linaro.org> | 2014-06-27 07:50:35 -0400 |
commit | cd01e32d91db5e7d549671ffbb747c4639eb8c72 (patch) | |
tree | 24d43293a3243eb411f8d0b082a9bb9e0f6ac7fa /drivers/regulator/twl-regulator.c | |
parent | 7171511eaec5bf23fb06078f59784a3a0626b38f (diff) |
regulator: twl: Convert to use devm_kmemdup()
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'drivers/regulator/twl-regulator.c')
-rw-r--r-- | drivers/regulator/twl-regulator.c | 13 |
1 files changed, 1 insertions, 12 deletions
diff --git a/drivers/regulator/twl-regulator.c b/drivers/regulator/twl-regulator.c index fed28abef419..0b4f8660fdb4 100644 --- a/drivers/regulator/twl-regulator.c +++ b/drivers/regulator/twl-regulator.c | |||
@@ -1128,7 +1128,7 @@ static int twlreg_probe(struct platform_device *pdev) | |||
1128 | if (!initdata) | 1128 | if (!initdata) |
1129 | return -EINVAL; | 1129 | return -EINVAL; |
1130 | 1130 | ||
1131 | info = kmemdup(template, sizeof(*info), GFP_KERNEL); | 1131 | info = devm_kmemdup(&pdev->dev, template, sizeof(*info), GFP_KERNEL); |
1132 | if (!info) | 1132 | if (!info) |
1133 | return -ENOMEM; | 1133 | return -ENOMEM; |
1134 | 1134 | ||
@@ -1192,7 +1192,6 @@ static int twlreg_probe(struct platform_device *pdev) | |||
1192 | if (IS_ERR(rdev)) { | 1192 | if (IS_ERR(rdev)) { |
1193 | dev_err(&pdev->dev, "can't register %s, %ld\n", | 1193 | dev_err(&pdev->dev, "can't register %s, %ld\n", |
1194 | info->desc.name, PTR_ERR(rdev)); | 1194 | info->desc.name, PTR_ERR(rdev)); |
1195 | kfree(info); | ||
1196 | return PTR_ERR(rdev); | 1195 | return PTR_ERR(rdev); |
1197 | } | 1196 | } |
1198 | platform_set_drvdata(pdev, rdev); | 1197 | platform_set_drvdata(pdev, rdev); |
@@ -1212,20 +1211,10 @@ static int twlreg_probe(struct platform_device *pdev) | |||
1212 | return 0; | 1211 | return 0; |
1213 | } | 1212 | } |
1214 | 1213 | ||
1215 | static int twlreg_remove(struct platform_device *pdev) | ||
1216 | { | ||
1217 | struct regulator_dev *rdev = platform_get_drvdata(pdev); | ||
1218 | struct twlreg_info *info = rdev->reg_data; | ||
1219 | |||
1220 | kfree(info); | ||
1221 | return 0; | ||
1222 | } | ||
1223 | |||
1224 | MODULE_ALIAS("platform:twl_reg"); | 1214 | MODULE_ALIAS("platform:twl_reg"); |
1225 | 1215 | ||
1226 | static struct platform_driver twlreg_driver = { | 1216 | static struct platform_driver twlreg_driver = { |
1227 | .probe = twlreg_probe, | 1217 | .probe = twlreg_probe, |
1228 | .remove = twlreg_remove, | ||
1229 | /* NOTE: short name, to work around driver model truncation of | 1218 | /* NOTE: short name, to work around driver model truncation of |
1230 | * "twl_regulator.12" (and friends) to "twl_regulator.1". | 1219 | * "twl_regulator.12" (and friends) to "twl_regulator.1". |
1231 | */ | 1220 | */ |