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)
committerNitin Garg <nitin.garg@nxp.com>
Tue, 20 Mar 2018 19:51:13 +0000 (14:51 -0500)
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 3f4f5c7..02f6dcc 100644 (file)
@@ -124,7 +124,9 @@ static void mxsfb_pipe_enable(struct drm_simple_display_pipe *pipe,
        struct mxsfb_drm_private *mxsfb = drm_pipe_to_mxsfb_drm_private(pipe);
 
        if (!mxsfb->connector) {
-               drm_for_each_connector(connector, drm)
+               list_for_each_entry(connector,
+                                   &drm->mode_config.connector_list,
+                                   head)
                        if (connector->encoder == &(mxsfb->pipe.encoder)) {
                                mxsfb->connector = connector;
                                break;