@@ -552,9 +552,9 @@ static int imx_ldb_panel_ddc(struct device *dev,
edidp = of_get_property(child, "edid",
&channel->edid_len);
if (edidp) {
- channel->edid = kmemdup(edidp,
- channel->edid_len,
- GFP_KERNEL);
+ channel->edid = devm_kmemdup(dev, edidp,
+ channel->edid_len,
+ GFP_KERNEL);
} else if (!channel->panel) {
/* fallback to display-timings node */
ret = of_get_drm_display_mode(child,
@@ -711,7 +711,6 @@ static void imx_ldb_unbind(struct device *dev, struct device *master,
if (channel->panel)
drm_panel_detach(channel->panel);
- kfree(channel->edid);
i2c_put_adapter(channel->ddc);
}
}
The edid memory is only freed if the component.unbind() is called. This is okay if the imx-ldb was bound but if the bind() fails we leek the memory. Signed-off-by: Marco Felsch <m.felsch@pengutronix.de> --- drivers/gpu/drm/imx/imx-ldb.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)