Skip to content

Commit cd01e32

Browse files
AxelLinbroonie
authored andcommitted
regulator: twl: Convert to use devm_kmemdup()
Signed-off-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Mark Brown <broonie@linaro.org>
1 parent 7171511 commit cd01e32

1 file changed

Lines changed: 1 addition & 12 deletions

File tree

‎drivers/regulator/twl-regulator.c‎

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1128,7 +1128,7 @@ static int twlreg_probe(struct platform_device *pdev)
11281128
if (!initdata)
11291129
return -EINVAL;
11301130

1131-
info = kmemdup(template, sizeof(*info), GFP_KERNEL);
1131+
info = devm_kmemdup(&pdev->dev, template, sizeof(*info), GFP_KERNEL);
11321132
if (!info)
11331133
return -ENOMEM;
11341134

@@ -1192,7 +1192,6 @@ static int twlreg_probe(struct platform_device *pdev)
11921192
if (IS_ERR(rdev)) {
11931193
dev_err(&pdev->dev, "can't register %s, %ld\n",
11941194
info->desc.name, PTR_ERR(rdev));
1195-
kfree(info);
11961195
return PTR_ERR(rdev);
11971196
}
11981197
platform_set_drvdata(pdev, rdev);
@@ -1212,20 +1211,10 @@ static int twlreg_probe(struct platform_device *pdev)
12121211
return 0;
12131212
}
12141213

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-
12241214
MODULE_ALIAS("platform:twl_reg");
12251215

12261216
static struct platform_driver twlreg_driver = {
12271217
.probe = twlreg_probe,
1228-
.remove = twlreg_remove,
12291218
/* NOTE: short name, to work around driver model truncation of
12301219
* "twl_regulator.12" (and friends) to "twl_regulator.1".
12311220
*/

0 commit comments

Comments
 (0)