lkml.org 
[lkml]   [2016]   [Jan]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] regulator: core: Clear constraints pointer after free on error path
Date
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.

Fixes: 29f5f4860a8e ("regulator: core: Move more deallocation into class unregister")
Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
---
drivers/regulator/core.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 744c988..a7936ab 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -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 */
--
2.1.4
\
 
 \ /
  Last update: 2016-01-26 16:41    [W:0.462 / U:0.092 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site