diff options
author | Pi-Hsun Shih <pihsun@chromium.org> | 2020-07-28 11:19:09 +0200 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2020-07-28 17:53:14 +0200 |
commit | 176cf704425f3d22603d379ffa4a1033a24a779d (patch) | |
tree | 37fc366220602a9ee0bc23d8fcc9c577682c81f7 /drivers/regulator | |
parent | platform/chrome: cros_ec: Fix host command for regulator control. (diff) | |
download | linux-176cf704425f3d22603d379ffa4a1033a24a779d.tar.xz linux-176cf704425f3d22603d379ffa4a1033a24a779d.zip |
regulator: cros-ec-regulator: Fix double free of desc->name.
The desc->name field is allocated with devm_kstrdup, but is also kfreed
on the error path, causing it to be double freed. Remove the kfree on
the error path.
Fixes: 8d9f8d57e023 ("regulator: Add driver for cros-ec-regulator")
Signed-off-by: Pi-Hsun Shih <pihsun@chromium.org>
Reviewed-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
Link: https://lore.kernel.org/r/20200728091909.2009771-1-pihsun@chromium.org
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/regulator')
-rw-r--r-- | drivers/regulator/cros-ec-regulator.c | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/drivers/regulator/cros-ec-regulator.c b/drivers/regulator/cros-ec-regulator.c index eeed5aac3f32..3117bbd2826b 100644 --- a/drivers/regulator/cros-ec-regulator.c +++ b/drivers/regulator/cros-ec-regulator.c @@ -222,18 +222,13 @@ static int cros_ec_regulator_probe(struct platform_device *pdev) drvdata->dev = devm_regulator_register(dev, &drvdata->desc, &cfg); if (IS_ERR(drvdata->dev)) { - ret = PTR_ERR(drvdata->dev); dev_err(&pdev->dev, "Failed to register regulator: %d\n", ret); - goto free_name; + return PTR_ERR(drvdata->dev); } platform_set_drvdata(pdev, drvdata); return 0; - -free_name: - kfree(desc->name); - return ret; } static const struct of_device_id regulator_cros_ec_of_match[] = { |