From patchwork Tue Nov 24 06:27:30 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dongsheng Wang X-Patchwork-Id: 7687791 Return-Path: X-Original-To: patchwork-linux-fbdev@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id D9026BF90C for ; Tue, 24 Nov 2015 06:49:38 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0D0D82080E for ; Tue, 24 Nov 2015 06:49:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2E94E20808 for ; Tue, 24 Nov 2015 06:49:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751470AbbKXGtg (ORCPT ); Tue, 24 Nov 2015 01:49:36 -0500 Received: from mail-bl2on0145.outbound.protection.outlook.com ([65.55.169.145]:54464 "EHLO na01-bl2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751326AbbKXGtg (ORCPT ); Tue, 24 Nov 2015 01:49:36 -0500 X-Greylist: delayed 879 seconds by postgrey-1.27 at vger.kernel.org; Tue, 24 Nov 2015 01:49:35 EST Received: from DM2PR03CA0039.namprd03.prod.outlook.com (10.141.96.38) by CY1PR03MB1485.namprd03.prod.outlook.com (10.163.17.158) with Microsoft SMTP Server (TLS) id 15.1.331.20; Tue, 24 Nov 2015 06:34:54 +0000 Received: from BY2FFO11OLC001.protection.gbl (2a01:111:f400:7c0c::101) by DM2PR03CA0039.outlook.office365.com (2a01:111:e400:2428::38) with Microsoft SMTP Server (TLS) id 15.1.331.20 via Frontend Transport; Tue, 24 Nov 2015 06:34:54 +0000 Authentication-Results: spf=permerror (sender IP is 192.88.158.2) smtp.mailfrom=freescale.com; freescale.mail.onmicrosoft.com; dkim=none (message not signed) header.d=none; freescale.mail.onmicrosoft.com; dmarc=none action=none header.from=freescale.com; Received-SPF: PermError (protection.outlook.com: domain of freescale.com used an invalid SPF mechanism) Received: from az84smr01.freescale.net (192.88.158.2) by BY2FFO11OLC001.mail.protection.outlook.com (10.1.15.185) with Microsoft SMTP Server (TLS) id 15.1.331.11 via Frontend Transport; Tue, 24 Nov 2015 06:34:54 +0000 Received: from titan.ap.freescale.net ([10.192.208.233]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id tAO6Yp4S011349; Mon, 23 Nov 2015 23:34:52 -0700 From: Dongsheng Wang To: CC: , , , Wang Dongsheng Subject: [PATCH] video: fbdev: fsl: fix kernel crash when diu_ops is not implemented Date: Tue, 24 Nov 2015 14:27:30 +0800 Message-ID: <1448346450-47403-1-git-send-email-dongsheng.wang@freescale.com> X-Mailer: git-send-email 2.1.0.27.g96db324 X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11OLC001; 1:jgip+ZoqumzYkCXrg3OnX8z1gmjkh9BGHOCypaqU92VSfkq3bcJRwmHSDR+tnXekKA0zCJTbxUJ99+/ipTFc4Y3CufsrWmI7z54WpcJ8MxV9U+Tb3A9fzvC1xO+t2sSSa/nldG3rUzqaO4mn4hI3hCNO/xkdptGIhB/dgokghOeUyiwuZHsvoSgEKaN24R5LpXmddBXv1JNrr5AjKYsjVdyuHc2zYcqG4rz5gKYracn6peoQPMOZsZdasT4yp1EkBS/QREoVOgg7ndykc+Nh7RIXA/zUpaD8Yq5zGCZpo9+nXjQYoWQEG22dT1TIdmvRdwSyOgfWI6lCt4hn8bxejhmuQ3Y2B7RCaytz+7pAMj7liQh155oLfv5EI6qdTWQlVsfUw0+xMUEwnwVj4sah7EjSzAF25kEYrnWH0UWPqzs= X-Forefront-Antispam-Report: CIP:192.88.158.2; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10019020)(6009001)(2980300002)(448002)(189002)(199003)(50226001)(19580405001)(69596002)(19580395003)(50466002)(4001430100002)(110136002)(87936001)(229853001)(85326001)(50986999)(97736004)(81156007)(86362001)(33646002)(5001960100002)(107886002)(36756003)(5003940100001)(2351001)(106466001)(5007970100001)(189998001)(48376002)(47776003)(6806005)(586003)(104016004)(92566002)(11100500001)(77096005)(5008740100001); DIR:OUT; SFP:1102; SCL:1; SRVR:CY1PR03MB1485; H:az84smr01.freescale.net; FPR:; SPF:PermError; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; MIME-Version: 1.0 X-Microsoft-Exchange-Diagnostics: 1; CY1PR03MB1485; 2:ELsEFQr+ihxbjL9RaUMlpGVyzzkbqsk0u59iZRf9UpjqiLSaW7+v5RoCgucXlAvS0vwP+jXSR3OttuqZ9G+6PYFyUx39ZdrVTyTp2Ep9TaBgz8nm82jGVc3OCpntyBsQEGGdyz5GkNo3MOMOr54oqA==; 3:cNwsqOWIYcgTDyXQ+eOVMKLtKUhdmPJzVc9C5c5iJoPrqOlAwmB8KfGWoXhy3Yzl3hI6fT9JXc6ZxPI4wA18FmgdewOGa0vBVEV+nuiHTYnc1vH1hpUoyYhYYJzPPHQwq6Y530x+Xv+xgeOMtYWTcal0p8EaEr8c2FWa/cZcDQHzBf4w4yU9BHaGOTHiT7SvCZwVgTymWm2VE36H/wcI4znDQM41a28f8imtH11oB/o=; 25:dGbLzyH09SqU6s5PFj5IaQyQa63E+7m4akmwt+RIc5BgL+i1t76OyN2o+/dPsLv0jTqAM8gZ5nXwa2dJ885PA/grIRD+fgOPjQiRef3yuMB/aFb4idUlph8ytxRq/6piCT8eNz/61Uj8ShL0eG8T4tIsqoc5Fo7owSkgNG4zUofZCtqMoHE6tldzpBNJTVV/B1I1OBIUe8KVG6y1K02ZDzyjx4zEJ5NABPIHY+IMsYjbYnnR1Tio6zANsVHkpqFbdDdU8MH87waxl/mafDO4EQ== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:CY1PR03MB1485; X-Microsoft-Exchange-Diagnostics: 1; CY1PR03MB1485; 20:46RfRiQNVswEByys2Yy/3Tk0Xa9Mtm4hUanj1fywWrYOwveLAb9sk/N4KuygqEJ5Fgt/uDWMIXYOoFqSQq/IbqkDVdK6L+/0KSqzuff/ch6k2IDqEn6+cGkR9RUvCWTinA6uqRZOhPtc4h0YUusmjFdNxzxSX5bDjciDzlAkzOB6CRp9wlFgCcw/K1lDxtJtFoaKuw+4jbhEagdSS0TfI/IFKV3NxPGAEwjIBhJh97ECd+x1CmqIF5fzOi1DmFPnDhg8GLvqrNIJiSN+Hc1oJeQNBpwq+FhrshDHyibgIoJL7tT8eeTNsqeFXx30FYDJz0xkD39KEo8D6kJuFR2W5ERFqP/XB+2eaC39e5LAG2Q=; 4:2BkIbN0o0nXV8lTRroWqREsE5106Fw2a4/BEQBZYdBRYDE9Cxg3y+a9gWUcCG/RXM2j10vlof1Yg1aIWuA04t2b0TAcxIMP09IGpQVtMMx32WeQItaI3zNWUha2uJWQEG6Y8sEr0L5NOLlYN0jLZRzfuG1Q/jXV6NYhSYW+A5uLk/XXb0Pu6ptXhi/B9eGsYx/990Ar4wdb8WhAfxZugC+xBZxysHFpnZ07iMyC5odcrvydq5oYlot23amdnfhPOgWmvQ9q4n/2jIPIcGC6Dw2srfvuqdKzOwr6GkxFGKZn5WE7NyorU3OKYpkmKEhcjQHBLNERqN+lVqeAiAnGfWu7rJU7bmzpoG9RRZoh4rhdlZwCpeFpew5LOoBvwwMxIs+dzCcilpkSUXMGrLQgCKmwpcPlKLTcr5B+mwHUp0ABVfe4aeulvU2RXCMnhDO+k X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(101931422205132); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(520078)(5005006)(8121501046)(10201501046)(3002001); SRVR:CY1PR03MB1485; BCL:0; PCL:0; RULEID:; SRVR:CY1PR03MB1485; X-Forefront-PR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?us-ascii?Q?Yer3TyGHMMRd+32pEnMcxKRO6/uP0VepgNfMpQNgEFEz8EZdXl+6OcduZ4w2?= =?us-ascii?Q?5rSdmUjraFEJkZMfOaFAacYTAMhVc+aeEvqTIx/DvcBIT3xhfQY46wiRiNSW?= =?us-ascii?Q?NY0KjFWRBgQDm0d7iqr8AQiV7Ce6KrMNPUXo7i3sUKxh1DvZVVY1rPr5koMA?= =?us-ascii?Q?mL3hkuNiZcGzPuHrQGdf4+m?= X-Microsoft-Exchange-Diagnostics: 1; CY1PR03MB1485; 5:Ae4TKfPLZ1EeBJu/00VOZlyyvOnXS2KH8lklQPMPn8iJIrF3Cc3QS8+EhrjNzthSWxLD7qLGfP5PGDMSc93SoExQ9OicFGIO0vMfL3xzj3s3XFwZAsI7KehXuuf4XNuQ7aW7GoeWxTnbM1zOOX5dXg==; 24:8glaO7t9yzbRF9npEYYXeHwPWFHtVPsmbZ9sZmepxK5VUmJLF0V9TJzSW0gqn+fCqmGZx3vvFf3gS+t79M9iGjPRPD3wdwJfWl0rlQe3u0Y= X-OriginatorOrg: freescale.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Nov 2015 06:34:54.4027 (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.158.2]; Helo=[az84smr01.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR03MB1485 Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Wang Dongsheng If diu_ops is not implemented on platform, kernel will access a null pointer. we need to check this pointer in diu initialization. Signed-off-by: Wang Dongsheng diff --git a/drivers/video/fbdev/fsl-diu-fb.c b/drivers/video/fbdev/fsl-diu-fb.c index b335c1a..288b5e4 100644 --- a/drivers/video/fbdev/fsl-diu-fb.c +++ b/drivers/video/fbdev/fsl-diu-fb.c @@ -479,7 +479,10 @@ static enum fsl_diu_monitor_port fsl_diu_name_to_port(const char *s) port = FSL_DIU_PORT_DLVDS; } - return diu_ops.valid_monitor_port(port); + if (diu_ops.valid_monitor_port) + port = diu_ops.valid_monitor_port(port); + + return port; } /* @@ -1697,6 +1700,9 @@ static int fsl_diu_probe(struct platform_device *pdev) unsigned int i; int ret; + if (!diu_ops.set_pixel_clock) + return -ENODEV; + data = dmam_alloc_coherent(&pdev->dev, sizeof(struct fsl_diu_data), &dma_addr, GFP_DMA | __GFP_ZERO); if (!data)