* [patch] drm/tegra: sor: Double free on error
@ 2016-07-04 7:45 Dan Carpenter
2016-07-06 14:17 ` Alexandre Courbot
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2016-07-04 7:45 UTC (permalink / raw)
To: Thierry Reding
Cc: David Airlie, Stephen Warren, Alexandre Courbot,
dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
linux-tegra-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
kernel-janitors-u79uwXL29TY76Z2rM5mHXA
"brick" is allocated with devm_kzalloc() so freeing it with kfree()
leads to a double free. We can just delete it.
Fixes: a7ba8310c7f5 ('drm/tegra: sor: Implement sor1_brick clock')
Signed-off-by: Dan Carpenter <dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
diff --git a/drivers/gpu/drm/tegra/sor.c b/drivers/gpu/drm/tegra/sor.c
index 8425eda..e750ced 100644
--- a/drivers/gpu/drm/tegra/sor.c
+++ b/drivers/gpu/drm/tegra/sor.c
@@ -345,7 +345,6 @@ static struct clk *tegra_clk_sor_brick_register(struct tegra_sor *sor,
{
struct tegra_clk_sor_brick *brick;
struct clk_init_data init;
- struct clk *clk;
brick = devm_kzalloc(sor->dev, sizeof(*brick), GFP_KERNEL);
if (!brick)
@@ -361,11 +360,7 @@ static struct clk *tegra_clk_sor_brick_register(struct tegra_sor *sor,
brick->hw.init = &init;
- clk = devm_clk_register(sor->dev, &brick->hw);
- if (IS_ERR(clk))
- kfree(brick);
-
- return clk;
+ return devm_clk_register(sor->dev, &brick->hw);
}
static int tegra_sor_dp_train_fast(struct tegra_sor *sor,
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [patch] drm/tegra: sor: Double free on error
2016-07-04 7:45 [patch] drm/tegra: sor: Double free on error Dan Carpenter
@ 2016-07-06 14:17 ` Alexandre Courbot
0 siblings, 0 replies; 2+ messages in thread
From: Alexandre Courbot @ 2016-07-06 14:17 UTC (permalink / raw)
To: Dan Carpenter
Cc: Stephen Warren, kernel-janitors, Linux Kernel Mailing List,
dri-devel@lists.freedesktop.org, linux-tegra@vger.kernel.org
On Mon, Jul 4, 2016 at 4:45 PM, Dan Carpenter <dan.carpenter@oracle.com> wrote:
> "brick" is allocated with devm_kzalloc() so freeing it with kfree()
> leads to a double free. We can just delete it.
That makes perfect sense.
Reviewed-by: Alexandre Courbot <acourbot@nvidia.com>
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-07-06 14:17 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-07-04 7:45 [patch] drm/tegra: sor: Double free on error Dan Carpenter
2016-07-06 14:17 ` Alexandre Courbot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox