[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <027fde47-86b3-35c8-85e6-ea7c191e772c@web.de>
Date: Sat, 5 Oct 2019 17:02:58 +0200
From: Markus Elfring <Markus.Elfring@....de>
To: Navid Emamdoost <navid.emamdoost@...il.com>,
dri-devel@...ts.freedesktop.org,
linux-arm-kernel@...ts.infradead.org, linux-imx@....com,
kernel@...gutronix.de
Cc: Navid Emamdoost <emamd001@....edu>, Kangjie Lu <kjlu@....edu>,
Stephen McCamant <smccaman@....edu>,
Daniel Vetter <daniel@...ll.ch>,
David Airlie <airlied@...ux.ie>,
Fabio Estevam <festevam@...il.com>,
Philipp Zabel <p.zabel@...gutronix.de>,
Sascha Hauer <s.hauer@...gutronix.de>,
Shawn Guo <shawnguo@...nel.org>, linux-kernel@...r.kernel.org,
kernel-janitors@...r.kernel.org
Subject: Re: [PATCH] drm/imx: fix memory leak in imx_pd_bind
> In imx_pd_bind, the duplicated memory for imxpd->edid via kmemdup should
> be released in drm_of_find_panel_or_bridge or imx_pd_register fail.
Please improve this change description.
> +++ b/drivers/gpu/drm/imx/parallel-display.c
> @@ -227,14 +227,18 @@ static int imx_pd_bind(struct device *dev, struct device *master, void *data)
>
> /* port@1 is the output port */
> ret = drm_of_find_panel_or_bridge(np, 1, 0, &imxpd->panel, &imxpd->bridge);
> - if (ret && ret != -ENODEV)
> + if (ret && ret != -ENODEV) {
> + kfree(imxpd->edid);
> return ret;
> + }
>
> imxpd->dev = dev;
Please use a jump target here instead of adding duplicate source code
for the completion of exception handling.
if (ret && ret != -ENODEV)
- return ret;
+ goto free_edid;
…
+free_edid:
+ kfree(imxpd->edid);
+ return ret;
Regards,
Markus
Powered by blists - more mailing lists