Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c539a6a5 authored by José Expósito's avatar José Expósito Committed by Greg Kroah-Hartman
Browse files

drm/imx: Fix memory leak in imx_pd_connector_get_modes



[ Upstream commit bce81feb03a20fca7bbdd1c4af16b4e9d5c0e1d3 ]

Avoid leaking the display mode variable if of_get_drm_display_mode
fails.

Fixes: 76ecd9c9 ("drm/imx: parallel-display: check return code from of_get_drm_display_mode()")
Addresses-Coverity-ID: 1443943 ("Resource leak")
Signed-off-by: default avatarJosé Expósito <jose.exposito89@gmail.com>
Signed-off-by: default avatarPhilipp Zabel <p.zabel@pengutronix.de>
Link: https://lore.kernel.org/r/20220108165230.44610-1-jose.exposito89@gmail.com


Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent cc9c2f51
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -68,8 +68,10 @@ static int imx_pd_connector_get_modes(struct drm_connector *connector)
		ret = of_get_drm_display_mode(np, &imxpd->mode,
					      &imxpd->bus_flags,
					      OF_USE_NATIVE_MODE);
		if (ret)
		if (ret) {
			drm_mode_destroy(connector->dev, mode);
			return ret;
		}

		drm_mode_copy(mode, &imxpd->mode);
		mode->type |= DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED,