regulator: core: Clear constraints pointer after free on error path
PATCH 1/1 regulator: core: Clear constraints pointer after free on error path
As we now free the constraints in regulator_dev_release we will still call free on the constraints pointer even if we went down an error path in regulator_register, as such we need to clear to the pointer to ensure the kfree in regulator_dev_release is a no-op.
--- drivers/regulator/core.c | 1 + 1 file changed, 1 insertion(+)
drivers/regulator/core.c +1 -0
@@ -3980,6 +3980,7 @@ unset_supplies: scrub:regulator_ena_gpio_free (rdev);kfree (rdev->constraints); + rdev->constraints =NULL ; wash:device_unregister (&rdev->dev);/* device core frees rdev */
Signature · 1 line
2.1.4
Mark Brown
maintainerQuoted 4 lines · Charles Keepax
As we now free the constraints in
regulator_dev_releasewe will still call free on the constraints pointer even if we went down an error path inregulator_register, as such we need to clear to the pointer to ensure the kfree inregulator_dev_releaseis a no-op.
No, this is just making things worse - if we're doing the free in the release we should be doing the free in the release not sometimes maybey in the release.
Quoted 10 lines · Mark Brown
Quoted 4 lines · Charles Keepax
As we now free the constraints in
regulator_dev_releasewe will still call free on the constraints pointer even if we went down an error path inregulator_register, as such we need to clear to the pointer to ensure the kfree inregulator_dev_releaseis a no-op.No, this is just making things worse - if we're doing the free in the release we should be doing the free in the release not sometimes maybey in the release.
Fair enough I will respin to remove the other free's.
Thanks,
Charles