Skip to content

Commit 5f2ca76

Browse files
Marco FelschpH5
authored andcommitted
drm/imx: parallel-display: fix edid memory leak
The edid memory is only freed if the component.unbind() is called. This is okay if the parallel-display was bound but if the bind() fails we leak the memory. Signed-off-by: Marco Felsch <m.felsch@pengutronix.de> [p.zabel@pengutronix.de: rebased, dropped now empty unbind()] Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
1 parent 754e0b5 commit 5f2ca76

1 file changed

Lines changed: 2 additions & 10 deletions

File tree

drivers/gpu/drm/imx/parallel-display.c

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,8 @@ static int imx_pd_bind(struct device *dev, struct device *master, void *data)
325325

326326
edidp = of_get_property(np, "edid", &imxpd->edid_len);
327327
if (edidp)
328-
imxpd->edid = kmemdup(edidp, imxpd->edid_len, GFP_KERNEL);
328+
imxpd->edid = devm_kmemdup(dev, edidp, imxpd->edid_len,
329+
GFP_KERNEL);
329330

330331
ret = of_property_read_string(np, "interface-pix-fmt", &fmt);
331332
if (!ret) {
@@ -349,17 +350,8 @@ static int imx_pd_bind(struct device *dev, struct device *master, void *data)
349350
return 0;
350351
}
351352

352-
static void imx_pd_unbind(struct device *dev, struct device *master,
353-
void *data)
354-
{
355-
struct imx_parallel_display *imxpd = dev_get_drvdata(dev);
356-
357-
kfree(imxpd->edid);
358-
}
359-
360353
static const struct component_ops imx_pd_ops = {
361354
.bind = imx_pd_bind,
362-
.unbind = imx_pd_unbind,
363355
};
364356

365357
static int imx_pd_probe(struct platform_device *pdev)

0 commit comments

Comments
 (0)