public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] soc: versatile: Add missing kfree in error path
@ 2016-01-11  6:16 Christophe JAILLET
  2016-01-11  6:16 ` [PATCH 2/2] soc: versatile: Drop a useless static qualifier Christophe JAILLET
  0 siblings, 1 reply; 4+ messages in thread
From: Christophe JAILLET @ 2016-01-11  6:16 UTC (permalink / raw)
  To: linus.walleij; +Cc: linux-kernel, kernel-janitors, Christophe JAILLET

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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] soc: versatile: Drop a useless static qualifier
  2016-01-11  6:16 [PATCH 1/2] soc: versatile: Add missing kfree in error path Christophe JAILLET
@ 2016-01-11  6:16 ` Christophe JAILLET
  2016-01-12 11:46   ` Dan Carpenter
  2016-01-14  9:12   ` Linus Walleij
  0 siblings, 2 replies; 4+ messages in thread
From: Christophe JAILLET @ 2016-01-11  6:16 UTC (permalink / raw)
  To: linus.walleij; +Cc: linux-kernel, kernel-janitors, Christophe JAILLET

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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/2] soc: versatile: Drop a useless static qualifier
  2016-01-11  6:16 ` [PATCH 2/2] soc: versatile: Drop a useless static qualifier Christophe JAILLET
@ 2016-01-12 11:46   ` Dan Carpenter
  2016-01-14  9:12   ` Linus Walleij
  1 sibling, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2016-01-12 11:46 UTC (permalink / raw)
  To: Christophe JAILLET; +Cc: linus.walleij, linux-kernel, kernel-janitors

It feels like there should be a static analysis warning for this.

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/2] soc: versatile: Drop a useless static qualifier
  2016-01-11  6:16 ` [PATCH 2/2] soc: versatile: Drop a useless static qualifier Christophe JAILLET
  2016-01-12 11:46   ` Dan Carpenter
@ 2016-01-14  9:12   ` Linus Walleij
  1 sibling, 0 replies; 4+ messages in thread
From: Linus Walleij @ 2016-01-14  9:12 UTC (permalink / raw)
  To: Christophe JAILLET; +Cc: linux-kernel@vger.kernel.org, kernel-janitors

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-01-14  9:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-11  6:16 [PATCH 1/2] soc: versatile: Add missing kfree in error path Christophe JAILLET
2016-01-11  6:16 ` [PATCH 2/2] soc: versatile: Drop a useless static qualifier Christophe JAILLET
2016-01-12 11:46   ` Dan Carpenter
2016-01-14  9:12   ` Linus Walleij

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox