From: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
To: <broonie@kernel.org>
Cc: <lgirdwood@gmail.com>, <linux-kernel@vger.kernel.org>,
<patches@opensource.wolfsonmicro.com>
Subject: [PATCH] regulator: core: Clear constraints pointer after free on error path
Date: Tue, 26 Jan 2016 15:14:16 +0000 [thread overview]
Message-ID: <1453821256-28179-1-git-send-email-ckeepax@opensource.wolfsonmicro.com> (raw)
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
next reply other threads:[~2016-01-26 15:14 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-26 15:14 Charles Keepax [this message]
2016-01-26 15:34 ` [PATCH] regulator: core: Clear constraints pointer after free on error path Mark Brown
2016-01-26 15:57 ` Charles Keepax
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1453821256-28179-1-git-send-email-ckeepax@opensource.wolfsonmicro.com \
--to=ckeepax@opensource.wolfsonmicro.com \
--cc=broonie@kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=patches@opensource.wolfsonmicro.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox