Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964905AbbKDKKh (ORCPT ); Wed, 4 Nov 2015 05:10:37 -0500 Received: from mail-bl2on0140.outbound.protection.outlook.com ([65.55.169.140]:39377 "EHLO na01-bl2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932598AbbKDKKd (ORCPT ); Wed, 4 Nov 2015 05:10:33 -0500 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=freescale.com; linux.ie; dkim=none (message not signed) header.d=none;linux.ie; dmarc=none action=none header.from=freescale.com; From: Liu Ying To: CC: , , Subject: [PATCH 2/2] drm/imx: Remove the primary plane created by create_primary_plane() Date: Wed, 4 Nov 2015 18:15:58 +0800 Message-ID: <1446632158-19998-2-git-send-email-Ying.Liu@freescale.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1446632158-19998-1-git-send-email-Ying.Liu@freescale.com> References: <1446632158-19998-1-git-send-email-Ying.Liu@freescale.com> X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1;BY2FFO11OLC003;1:EQpmN57x/Nil57W/ucp/T01jPku0+QhPmCCtCpIAyKa4ODnMvk7Jpa3jICAOcalt1MkxH+qhT4B6CtMDwKP4VpkQzSCrQJ53TQNUrwZbJ91Ottp/qQfBnkIJjCYUxrXEJCX8kF8Mq4WIrniktnWvK+PmRIiUligj1fLgESvJRg/Fn4BkoqO20i1ovSqysAuNGMCKDtYtNN66F88P9smVFclak7UFNL6lfL2c69z0Hio62FfbfLzDlKtkqLQEO414H2LAjyAHyrnhDqiKsY1DXGmrZHs2Y6eUsYQxF1o6+BXB3mQRquIc4z6sq4DsX53Koq2Qz+Qj+bbr0XIah6Nla7UrDduyJpyg0VlQj7YbczeAO1zt2lqGCt0mBhkmAGhq X-Forefront-Antispam-Report: CIP:192.88.168.50;CTRY:US;IPV:NLI;EFV:NLI;SFV:NSPM;SFS:(10019020)(6009001)(2980300002)(1109001)(1110001)(339900001)(199003)(189002)(81156007)(19580405001)(6806005)(5007970100001)(104016004)(110136002)(229853001)(5008740100001)(19580395003)(86362001)(36756003)(50986999)(77096005)(97736004)(92566002)(105606002)(189998001)(106466001)(2950100001)(47776003)(5001960100002)(50226001)(2351001)(11100500001)(85426001)(87936001)(50466002)(5890100001)(5003940100001)(76176999)(48376002);DIR:OUT;SFP:1102;SCL:1;SRVR:BN3PR03MB1462;H:tx30smr01.am.freescale.net;FPR:;SPF:Fail;PTR:InfoDomainNonexistent;A:1;MX:1;LANG:en; MIME-Version: 1.0 Content-Type: text/plain X-Microsoft-Exchange-Diagnostics: 1;BN3PR03MB1462;2:cRsBYk+KJyw12Rn0rBNWOmYJI2mNaWCLOq0jQynGGX14eRJIWRH/+f6bQ+8tvpqsnwwo0+7A1a85H3jBWexO9/Uh4gIGvu5VW7xuNOQvsBD/6TmoYBFUaZ/nO3t7XULDhpGkkCdABVGEKVLaQ/gsOMHbhEH1pRFIwV/LFaO1TlU=;3:jsOif6VKVi7lZz1OsoPR6jBJr+V2dxfnrugthDNN4KS25t1cslw16rZ+SpDrHb8jWX2v03/ULLdFUdW6FP4KISXZUWyLHJKuspux5YHR8TaxZwMzezLbrtILncn2jpRRdHmm4VHaC1ITcEIrOTsr45wE59jICcF9B66yIB7H0UsaXZXq8Pjbq9xcmljY6N8lYIBOOtg7JxI540nn9hKYbMzydqj8z8Q8GDIojo9CZcQ=;25:fkoTYHV0nIzDGrMa8MIaCH0GtZcK0zcoEm6Npl16qwSjPNxt2O52qbOhszGwIgXNKPz3dlGvs+dkEfbIWvjIE1I4999mcEW0gqgv6pYDcS2goO1jn1L+f0uk+7EeEsQNkWByLKPudSQXbIEfXr2tOoW1mYdY7ifAGckeaCNR3MOX8qKjzZyu+UW2QyHdo0v/BPgyajt2/DnT8AdcX8Rz/AglGjrp82wBvSswE8+vEOLsxTTHvnDkBR4TerN1O5FgdCuoVS+6N/vCQ4e68plqOg== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BN3PR03MB1462; X-Microsoft-Exchange-Diagnostics: 1;BN3PR03MB1462;20:Djo+htua6kN+b+e4RVab1Gh5C5MRR7hX9FZKgcy8I7XsvogYnZAYwCcK5qYUlZxq0tREau2gq4XLE4LAa4WfMpinU/aZNJMbXA9yG589BW3xZRKBJ20muikW5ffXNGnJv2gUl8cxy9D9Pcxj+I+To8tYa/Gvtcb3v3MJ++i0eLDMAfY29NDh6RQhpEI+Drwu57SoOJVBlIpqIONirMKJIDSg+8q0R6OEcQEnSJhFRGhi6Tnmbl1kx1mhOk0wDqS3AIRVP5xQUg32OnooaqcSdUs6Pah4/rRLvhSI7oOAhno3M2NOXawkzNTO9UKzzXHS5Fo6XPqgWeALAue87nAyJn3YxSKlZB8fmBXDcgfzf3U=;4:IXBCrkMjRv2F/G/EYH9HthsBxOaK7uKLRgedK8NvHKGRDOu1xdXY7XAHlcUwMbQjDDmoedgj72CyjqwmoVkf+tUsZ74cFc+auZ7gghf3sX+QvjZjCJjGJBRavyF7tiVnfbAJYJe/H/RpkACq4j+6/YxyZp7Kz8p5JWSn3VMgKtr/s9wVapO3UmOz8Rakmm+nHJmrZNPX4M1S4oSvKc3hSzolKU+NWPhW6veoNurdhqrU3L2lMwQ3nmJNnrVU+XIQI1SYJefJ+2lo4NAnOTeHZfRP/fqoRS8+Z4dgTFR5Y1gijPCY/cZH4uf4xgTJ29sIkGvfLMGZyRA4dSLLL13XeKN/OVvzRZQ2Twj8QGy9yJOW3LahLkxyouUUOK9n1+Ne X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(101931422205132); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(2401047)(8121501046)(5005006)(520078)(10201501046)(3002001);SRVR:BN3PR03MB1462;BCL:0;PCL:0;RULEID:;SRVR:BN3PR03MB1462; X-Forefront-PRVS: 0750463DC9 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;BN3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?= =?us-ascii?Q?E4uOZXtFzmx5apNkOYuUy8cDgJKkSEmhPCS09cCoYiKk/1TWp/mSNTlAwzTQ?= =?us-ascii?Q?HzF8bAc1176Yk7lCMYpB8VneQR5G2rrRMm8LmCf+rR8H5LhM8cP+SOUxI99t?= =?us-ascii?Q?87I43NVrfR/V059OExRMmUwib0WzEJFkJ06gR3lSp1b4Q=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1;BN3PR03MB1462;5:XdiVq36zipo2POhYTT0UDbD2fc+BEwstY4c2modeCACfJupz723nxwUtahnqC1lm7PNhb2xB0zeqqUkh9imzA9DSu2qr4KRil0LB5rwdQDeTeto0U0j/OgQe3JI/xaGh8KfxhQFM6+vr0zsemV+qYw==;24:7aqw6jSjM8uPQmXr4TioCOD/kaUiTnDMj0NAgQw60eMbGdcB27ywwONSqo1qXigu/io68AvJwYMChfRoPG1VsObm8qMSiPjRzrvw8+BL1N8=;20:42U+5eXcJMpLo7FKtP1HDkCVJ+M+3ggBX4/mau8I9mX9khSADdZocYBiE5FZPkPtbfCPUITJ5mOK0yScBaPUSg== SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: freescale.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Nov 2015 10:10:30.4642 (UTC) X-MS-Exchange-CrossTenant-Id: 710a03f5-10f6-4d38-9ff4-a80b81da590d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=710a03f5-10f6-4d38-9ff4-a80b81da590d;Ip=[192.88.168.50];Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN3PR03MB1462 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2769 Lines: 69 Since we are using ipu_plane_init() to add one primary plane for each IPU CRTC, it's unnecessary to create the safe one by using the helper create_primary_plane(). Furthermore, the safe one is attached to crtc->primary, which actually carries a framebuffer(crtc->primary->fb) created by the fbdev helper to build up the fbcon. Instead, the one created by ipu_plane_init() is dangling, but it is the one actually does ipu_plane_mode_set() for the fbcon. This may causes the mismatch bewteen ipu_plane->enabled(true) and ipu_plane->base.fb(NULL). Thus, it brings a NULL pointer dereference issue in ipu_plane_mode_set() when we try to additionally touch the IDMAC channel of the ipu_plane. This issue could be reproduced by running the drm modetest with command line 'modetest -P 19:1024x768@XR24' on the i.MX6Q SabreSD platform(single LVDS display). This patch binds the plane created by ipu_plane_init() with crtc->primary and removes the safe one to address this issue. Signed-off-by: Liu Ying --- drivers/gpu/drm/imx/imx-drm-core.c | 3 ++- drivers/gpu/drm/imx/ipuv3-crtc.c | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/imx/imx-drm-core.c b/drivers/gpu/drm/imx/imx-drm-core.c index 6faa735..08eceeb 100644 --- a/drivers/gpu/drm/imx/imx-drm-core.c +++ b/drivers/gpu/drm/imx/imx-drm-core.c @@ -373,7 +373,8 @@ int imx_drm_add_crtc(struct drm_device *drm, struct drm_crtc *crtc, drm_crtc_helper_add(crtc, imx_drm_crtc->imx_drm_helper_funcs.crtc_helper_funcs); - drm_crtc_init(drm, crtc, + /* The related primary plane will be created in ipu_plane_init(). */ + drm_crtc_init_with_planes(drm, crtc, NULL, NULL, imx_drm_crtc->imx_drm_helper_funcs.crtc_funcs); return 0; diff --git a/drivers/gpu/drm/imx/ipuv3-crtc.c b/drivers/gpu/drm/imx/ipuv3-crtc.c index 8d68697..d27143f 100644 --- a/drivers/gpu/drm/imx/ipuv3-crtc.c +++ b/drivers/gpu/drm/imx/ipuv3-crtc.c @@ -343,6 +343,11 @@ err_out: return ret; } +static inline void ipu_crtc_set_primary_plane(struct ipu_crtc *ipu_crtc) +{ + ipu_crtc->base.primary = &ipu_crtc->plane[0]->base; +} + static int ipu_crtc_init(struct ipu_crtc *ipu_crtc, struct ipu_client_platformdata *pdata, struct drm_device *drm) { @@ -380,6 +385,7 @@ static int ipu_crtc_init(struct ipu_crtc *ipu_crtc, ret); goto err_remove_crtc; } + ipu_crtc_set_primary_plane(ipu_crtc); /* If this crtc is using the DP, add an overlay plane */ if (pdata->dp >= 0 && pdata->dma[1] > 0) { -- 2.5.0 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/