Commit 622c9a3a authored by Alexander Stein's avatar Alexander Stein Committed by Marek Vasut

drm: mxsfb: Fix NULL pointer dereference

mxsfb should not ever dereference the NULL pointer which
drm_atomic_get_new_bridge_state is allowed to return.
Assume a fixed format instead.

Fixes: b776b0f0 ("drm: mxsfb: Use bus_format from the nearest bridge if present")
Signed-off-by: default avatarAlexander Stein <alexander.stein@ew.tq-group.com>
Signed-off-by: default avatarMarek Vasut <marex@denx.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20220202081755.145716-3-alexander.stein@ew.tq-group.com
parent a3f781a9
...@@ -361,7 +361,11 @@ static void mxsfb_crtc_atomic_enable(struct drm_crtc *crtc, ...@@ -361,7 +361,11 @@ static void mxsfb_crtc_atomic_enable(struct drm_crtc *crtc,
bridge_state = bridge_state =
drm_atomic_get_new_bridge_state(state, drm_atomic_get_new_bridge_state(state,
mxsfb->bridge); mxsfb->bridge);
bus_format = bridge_state->input_bus_cfg.format; if (!bridge_state)
bus_format = MEDIA_BUS_FMT_FIXED;
else
bus_format = bridge_state->input_bus_cfg.format;
if (bus_format == MEDIA_BUS_FMT_FIXED) { if (bus_format == MEDIA_BUS_FMT_FIXED) {
dev_warn_once(drm->dev, dev_warn_once(drm->dev,
"Bridge does not provide bus format, assuming MEDIA_BUS_FMT_RGB888_1X24.\n" "Bridge does not provide bus format, assuming MEDIA_BUS_FMT_RGB888_1X24.\n"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment