drm/sun4i: dsi: Avoid hotplug race with DRM driver bind

We need to make sure that the DRM driver is fully registered before
allowing the panel to be attached. Otherwise, we may trigger a hotplug
event before sun4i_framebuffer_init() sets up drm->mode_config.funcs,
causing a NULL pointer dereference.

Fixes: 1a2703bd73 ("drm/sun4i: dsi: Allow binding the host without a panel")
Signed-off-by: Samuel Holland <samuel@sholland.org>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Link: https://patchwork.freedesktop.org/patch/msgid/20200217060906.15152-1-samuel@sholland.org
This commit is contained in:
Samuel Holland 2020-02-17 00:09:06 -06:00 коммит произвёл Maxime Ripard
Родитель 91ea83306b
Коммит 80579bf36c
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: E3EF0D6F671851C5
1 изменённых файлов: 1 добавлений и 1 удалений

Просмотреть файл

@ -970,7 +970,7 @@ static int sun6i_dsi_attach(struct mipi_dsi_host *host,
if (IS_ERR(panel))
return PTR_ERR(panel);
if (!dsi->drm)
if (!dsi->drm || !dsi->drm->registered)
return -EPROBE_DEFER;
dsi->panel = panel;