Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1305875 > unrolled thread

[PATCH 1/2] soc: versatile: Add missing kfree in error path

Started byChristophe JAILLET <christophe.jaillet@wanadoo.fr>
First post2016-01-11 07:30 +0100
Last post2016-01-14 10:20 +0100
Articles 4 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 1/2] soc: versatile: Add missing kfree in error path Christophe JAILLET <christophe.jaillet@wanadoo.fr> - 2016-01-11 07:30 +0100
    [PATCH 2/2] soc: versatile: Drop a useless static qualifier Christophe JAILLET <christophe.jaillet@wanadoo.fr> - 2016-01-11 07:30 +0100
      Re: [PATCH 2/2] soc: versatile: Drop a useless static qualifier Dan Carpenter <dan.carpenter@oracle.com> - 2016-01-12 12:50 +0100
      Re: [PATCH 2/2] soc: versatile: Drop a useless static qualifier Linus Walleij <linus.walleij@linaro.org> - 2016-01-14 10:20 +0100

#1305875 — [PATCH 1/2] soc: versatile: Add missing kfree in error path

FromChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Date2016-01-11 07:30 +0100
Subject[PATCH 1/2] soc: versatile: Add missing kfree in error path
Message-ID<qPE9j-6Vv-9@gated-at.bofh.it>
If 'of_property_read_string' fails, then 'soc_dev_attr' should be freed,
otherwise, there is a memory leak.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
This patch has already been
   Acked-by: Linus Walleij <linus.walleij@linaro.org>
on 17/07/2015
---
 drivers/soc/versatile/soc-realview.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/soc/versatile/soc-realview.c b/drivers/soc/versatile/soc-realview.c
index c337764..39ffe18 100644
--- a/drivers/soc/versatile/soc-realview.c
+++ b/drivers/soc/versatile/soc-realview.c
@@ -113,8 +113,10 @@ static int realview_soc_probe(struct platform_device *pdev)
 
 	ret = of_property_read_string(np, "compatible",
 				      &soc_dev_attr->soc_id);
-	if (ret)
+	if (ret) {
+		kfree(soc_dev_attr);
 		return -EINVAL;
+	}
 
 	soc_dev_attr->machine = "RealView";
 	soc_dev_attr->family = "Versatile";
-- 
2.5.0

[toc] | [next] | [standalone]


#1305879 — [PATCH 2/2] soc: versatile: Drop a useless static qualifier

FromChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Date2016-01-11 07:30 +0100
Subject[PATCH 2/2] soc: versatile: Drop a useless static qualifier
Message-ID<qPE9k-6Vv-23@gated-at.bofh.it>
In reply to#1305875
There is no need to have the 'struct regmap *syscon_regmap' variable
static in the probe function.
It only wastes a few bytes of memory.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 drivers/soc/versatile/soc-realview.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/soc/versatile/soc-realview.c b/drivers/soc/versatile/soc-realview.c
index 39ffe18..6d26288 100644
--- a/drivers/soc/versatile/soc-realview.c
+++ b/drivers/soc/versatile/soc-realview.c
@@ -97,7 +97,7 @@ static struct device_attribute realview_build_attr =
 
 static int realview_soc_probe(struct platform_device *pdev)
 {
-	static struct regmap *syscon_regmap;
+	struct regmap *syscon_regmap;
 	struct soc_device *soc_dev;
 	struct soc_device_attribute *soc_dev_attr;
 	struct device_node *np = pdev->dev.of_node;
-- 
2.5.0

[toc] | [prev] | [next] | [standalone]


#1307313 — Re: [PATCH 2/2] soc: versatile: Drop a useless static qualifier

FromDan Carpenter <dan.carpenter@oracle.com>
Date2016-01-12 12:50 +0100
SubjectRe: [PATCH 2/2] soc: versatile: Drop a useless static qualifier
Message-ID<qQ5Cy-jP-21@gated-at.bofh.it>
In reply to#1305879
It feels like there should be a static analysis warning for this.

regards,
dan carpenter

[toc] | [prev] | [next] | [standalone]


#1309103 — Re: [PATCH 2/2] soc: versatile: Drop a useless static qualifier

FromLinus Walleij <linus.walleij@linaro.org>
Date2016-01-14 10:20 +0100
SubjectRe: [PATCH 2/2] soc: versatile: Drop a useless static qualifier
Message-ID<qQMeu-4Y2-11@gated-at.bofh.it>
In reply to#1305879
On Mon, Jan 11, 2016 at 7:16 AM, Christophe JAILLET
<christophe.jaillet@wanadoo.fr> wrote:

> There is no need to have the 'struct regmap *syscon_regmap' variable
> static in the probe function.
> It only wastes a few bytes of memory.
>
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>

Sorry a copy-paste error ... used to have it as a global.

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

I think you should send this to arm@kernel.org for application
as a fixup to the ARM SoC tree. Include my Review tag.

Yours,
Linus Walleij

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web