MLK-17149-1: drm/mxsfb: Fix pipe enable
authorRobert Chiras <robert.chiras@nxp.com>
Mon, 11 Dec 2017 10:09:36 +0000 (12:09 +0200)
committerLeonard Crestez <leonard.crestez@nxp.com>
Wed, 17 Apr 2019 23:51:34 +0000 (02:51 +0300)
During enable function, the mxsfb driver is trying to associate with a
connector, when a drm_bridge is used. When accessing the connectors
list, mode_config->mutex might be locked, generating the below WARN.
Since we are not changing the mode_config, we can access the
connector_list directly.

[   16.876991] [<ffff0000086289d4>] mxsfb_pipe_enable+0xec/0xf8
[   16.882650] [<ffff0000085e4de0>] drm_simple_kms_crtc_enable+0x20/0x30
[   16.889090] [<ffff0000085e144c>]
drm_atomic_helper_commit_modeset_enables+0x17c/0x1a0
[   16.896918] [<ffff0000085e42dc>]
drm_atomic_helper_commit_tail+0x3c/0x68
[   16.903617] [<ffff0000085e436c>] commit_tail+0x64/0x80
[   16.908753] [<ffff0000085e4398>] commit_work+0x10/0x18
[   16.913893] [<ffff0000080d4928>] process_one_work+0x1c8/0x380
[   16.919638] [<ffff0000080d4b28>] worker_thread+0x48/0x498
[   16.925035] [<ffff0000080da8f8>] kthread+0xe0/0xf8
[   16.929828] [<ffff000008082e80>] ret_from_fork+0x10/0x50

Signed-off-by: Robert Chiras <robert.chiras@nxp.com>
Reviewed-by: Laurentiu Palcu <laurentiu.palcu@nxp.com>
drivers/gpu/drm/mxsfb/mxsfb_drv.c

index ec919ab..4b90f6d 100644 (file)
@@ -123,17 +123,16 @@ static void mxsfb_pipe_enable(struct drm_simple_display_pipe *pipe,
 {
        struct drm_device *drm = pipe->encoder.dev;
        struct drm_connector *connector;
-       struct drm_connector_list_iter conn_iter;
        struct mxsfb_drm_private *mxsfb = drm_pipe_to_mxsfb_drm_private(pipe);
 
        if (!mxsfb->connector) {
-               drm_connector_list_iter_begin(drm, &conn_iter);
-               drm_for_each_connector_iter(connector, &conn_iter)
+               list_for_each_entry(connector,
+                                   &drm->mode_config.connector_list,
+                                   head)
                        if (connector->encoder == &(mxsfb->pipe.encoder)) {
                                mxsfb->connector = connector;
                                break;
                        }
-               drm_connector_list_iter_end(&conn_iter);
        }
 
        if (!mxsfb->connector) {