drm/fb-helper: generic: Call drm_client_add() after setup is done
authorNoralf Trønnes <noralf@tronnes.org>
Mon, 1 Apr 2019 14:13:58 +0000 (16:13 +0200)
committerNoralf Trønnes <noralf@tronnes.org>
Wed, 3 Apr 2019 09:11:47 +0000 (11:11 +0200)
Hotplug can happen while drm_fbdev_generic_setup() is running so move
drm_client_add() call after setup is done to avoid
drm_fbdev_client_hotplug() running in two threads at the same time.

Fixes: 9060d7f49376 ("drm/fb-helper: Finish the generic fbdev emulation")
Cc: stable@vger.kernel.org
Reported-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20190401141358.25309-1-noralf@tronnes.org
drivers/gpu/drm/drm_fb_helper.c

index 0d8384e30e168912a07a8b8948d14c21371ad760..84791dd4a90d3838801388043687001d5bb86abc 100644 (file)
@@ -3312,8 +3312,6 @@ int drm_fbdev_generic_setup(struct drm_device *dev, unsigned int preferred_bpp)
                return ret;
        }
 
-       drm_client_add(&fb_helper->client);
-
        if (!preferred_bpp)
                preferred_bpp = dev->mode_config.preferred_depth;
        if (!preferred_bpp)
@@ -3324,6 +3322,8 @@ int drm_fbdev_generic_setup(struct drm_device *dev, unsigned int preferred_bpp)
        if (ret)
                DRM_DEV_DEBUG(dev->dev, "client hotplug ret=%d\n", ret);
 
+       drm_client_add(&fb_helper->client);
+
        return 0;
 }
 EXPORT_SYMBOL(drm_fbdev_generic_setup);