From patchwork Wed Dec 2 13:20:16 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dongsheng Wang X-Patchwork-Id: 7745971 Return-Path: X-Original-To: patchwork-linux-fbdev@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id A68749F387 for ; Wed, 2 Dec 2015 13:27:39 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BAEBA20631 for ; Wed, 2 Dec 2015 13:27:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D78FD20627 for ; Wed, 2 Dec 2015 13:27:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751324AbbLBN1h (ORCPT ); Wed, 2 Dec 2015 08:27:37 -0500 Received: from mail-bn1on0146.outbound.protection.outlook.com ([157.56.110.146]:6563 "EHLO na01-bn1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750870AbbLBN1g (ORCPT ); Wed, 2 Dec 2015 08:27:36 -0500 Received: from BN3PR0301CA0041.namprd03.prod.outlook.com (10.160.180.179) by BY2PR0301MB1606.namprd03.prod.outlook.com (10.163.28.24) with Microsoft SMTP Server (TLS) id 15.1.331.20; Wed, 2 Dec 2015 13:27:33 +0000 Received: from BL2FFO11FD042.protection.gbl (2a01:111:f400:7c09::141) by BN3PR0301CA0041.outlook.office365.com (2a01:111:e400:4000::51) with Microsoft SMTP Server (TLS) id 15.1.331.20 via Frontend Transport; Wed, 2 Dec 2015 13:27:33 +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 BL2FFO11FD042.mail.protection.outlook.com (10.173.161.138) with Microsoft SMTP Server (TLS) id 15.1.337.8 via Frontend Transport; Wed, 2 Dec 2015 13:27:33 +0000 Received: from titan.ap.freescale.net ([10.192.208.233]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id tB2DRTrh003746; Wed, 2 Dec 2015 06:27:30 -0700 From: Dongsheng Wang To: CC: , , , Wang Dongsheng Subject: [PATCH v2] video: fbdev: fsl: fix kernel crash when diu_ops is not implemented Date: Wed, 2 Dec 2015 21:20:16 +0800 Message-ID: <1449062416-12245-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; BL2FFO11FD042; 1:aFHX6yn1lE+yF1ZONSigUeotOMZ7ZZslcrQR66PFOybJ+sSRnQbMFOeSp/G+SblPo8JXUfP/xrtcjXFcVxxPnXocYyIwdX1dseYykFNNH/kDGUMtBwlbwCqfkucrys8s8AoskfGDZS73axEe6MZr9H7T5Q6fYcmTp/Jaong1+QzIrNSV50YLgkQ0xqaMqPvEakAkqGRUErn1CmzVfARAleNeYRmJeQ7qiCa+gDVYrQHC346KvBkouN4c5jN2SgVRMciED8TZRRGAch+GWLjFeEEj9jznUq/NyqzWBiGCimmrx1Zkv5aNq2m6/y3VItNtNtKC6a2+G9vYfnTwNqOFp4colLVdrsl8JnlXqp9+TmrEZQLL5qN+Ah5369zF7YTPYaHQJnrp88r0WeWyOh2I+4TsKtAFwfXeUyrsjSuaZyQ= X-Forefront-Antispam-Report: CIP:192.88.158.2; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10019020)(6009001)(2980300002)(448002)(199003)(189002)(50466002)(50226001)(36756003)(5003940100001)(33646002)(87936001)(48376002)(85326001)(106466001)(5001960100002)(47776003)(2351001)(77096005)(110136002)(107886002)(229853001)(189998001)(97736004)(86362001)(1096002)(1220700001)(4001430100002)(19580395003)(81156007)(19580405001)(104016004)(69596002)(92566002)(50986999)(6806005)(5008740100001)(11100500001)(586003); DIR:OUT; SFP:1102; SCL:1; SRVR:BY2PR0301MB1606; H:az84smr01.freescale.net; FPR:; SPF:PermError; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; MIME-Version: 1.0 X-Microsoft-Exchange-Diagnostics: 1; BY2PR0301MB1606; 2:EingVXSonb7E4osWnDWHj/OBoW5mgrpTtsgZY3nkJSEMEaqi7srF64EufoOqtP0tb+kVY0Y45LUekvbUJ3cBZ0E6cgCm695++QFTCFuderzW+wag1WJhEq0+7Ze3H44JGHLuf4tnIc+EriQx444u4g==; 3:4xGxEWF5pTJtZiDqmKubb5isgq3keIFsz/fy04FrsopMMkHV4NiE8SRppRa4+2bmcCi62SnJDePGxdrVem5I+u4fdilqlZV3zQo88tfMqDCf45oaVz1aGP5/wTGE9kS5wj0xbIEImDobOwTle4v34L+MPLj+dBOwDpd90GT5Yu/0orWn2z7EjM4oqT5VnuM5MtdJ2s5erpA9YlEOfgjwy1N7Qd9VCbGiOcgEvaPeFhU=; 25:5S/6enImIwyml8EGdxfI/a7Kta3vaOanBieI7wKA54Xb2qu4Bo2XoE5syFYPYwKbHvfPAe95CMAilC/6BLT+eNo2aBokYiX1iX9MZMAMdXNG6cC2MxMEb3v8yXIAQrUJsyYvZBPjbDP8OK/22RGLvsyWRJ5hIZy19i4IDVCUnT9spvEgab7kP20aoQCcFZQvY84ZK3wpY5f9K4hL8e++IIudq1G5QOojsudON15CU667Lv5yXcdJ7+5outSs4ytIKBILMR3iP88RUyCgCDN7Bw== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BY2PR0301MB1606; X-Microsoft-Exchange-Diagnostics: 1; BY2PR0301MB1606; 20:HqdF3HKfuWEsqTdR4gN9FXIUsxHSxNsTUtVs377DQAOuUbGXPhjnRk+rO5yCX9kcsVgGG2TCHQbAs9jDBdp/c/0LCJzN2IALW6neQ48yVG3js5LIN/sxFj4rYjtj9L3rkKtbhFIVuYoRrMLcvxUVX5tOWWu+RhKDHz8C+EBbYJv+umbMGnTljOEZl4uGx+s/ogp9NEOXp5Fos8C2yDmpMtRv+YEWECPvSU+NV/vAyIQUO5TA3YqkMKgPcoRXSFSe0Yf7y8iE4zdTAmlVvZF7cQKxnoLNv2TpA1uRyt7yjgejaH90aL3q3+nrzTqNMD2lUDPcmVR+gqq+0IoJYFA3eZVvZRT6CLj/JpVgRdL8l+Y=; 4:wzr5xESEzvB5fxA3QIwTNHTq5qeTonvyuVqOJJxeGimMpR20r2KYQ3N0mPRPzL/g0tzXIcp805ji/NqDSz/vV7AAhAT0mbhECNWALamcQ5/7qwyPwSPDQGrNfROUmY2y3687cMVAB9n4YzyKF/2VpitSqM9bvGl1Tm4M02gDpPqhSiP6MHm5rXMtIFs5Jp92dT1Bp1IIX/G7HHlzw27ZIDphMEDCu2zCntZlF1VpCvzP4+QtyguZcB4nEZFyTxuL1D+lcsy3XN4lgm6NjIu2n/zCdEV4Xr66M0RVxorqANd6SiOyLrNUTr4dxqshSopv1PltwSi7MdGApd/0e+veYH0zW88ixHLgz5WZNGFKw42f4NuUBDD1KMMbI0ciSfx7pjU1fV3zmjyrxjkxAQ3PlnpwwoF762KCok784nKbPARLbCfOVQjImZqWDmqRZA/Z 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)(8121501046)(5005006)(10201501046)(3002001); SRVR:BY2PR0301MB1606; BCL:0; PCL:0; RULEID:; SRVR:BY2PR0301MB1606; X-Forefront-PRVS: 077884B8B5 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BY2PR0301MB1606; 23:aw1LDa+OkZmpHbbolXf74MczhtMBgXBQlP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dMote5m54OoR3D7efG1FhRsTe87NaKJcO/8R?= =?us-ascii?Q?SPdHH39fCtNZlDD8jQ03jafw2v/eDl6UAYyYqo+A9Hl/PE5BP/wEliJQQ3qX?= =?us-ascii?Q?Q/baZ9WhOp/uKw/S/5O7+rpmIPoQhbvOABgkz6kjzSqciZQ=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1; BY2PR0301MB1606; 5:oECwlQr8Tk4x6ZKZxCus7fJWP9nvYP646hI9xhmA3vphakpkkRlwDAhfPEMHtuqVkNmE/GEHWG5xBdla2qdgI0BP9gRgoeDb1LMq6m7WNIffcwzFQExEWVDU7wQGNo9uXZNP72X6F/YXLqUK6bAEkw==; 24:0img2C2jnoHMWCmvwRJbS3ka1UakbmkYh8bwcnSma0Lt5q6kmOcSmXQFLlc3KR4dp/nayRlG1+pz7MUsP4GCe9K37cuDjO/zIIsdzXegueo= X-OriginatorOrg: freescale.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Dec 2015 13:27:33.1138 (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: BY2PR0301MB1606 Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_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 --- v2: - Move set_pixel_clock judgement to fsl_diu_init. diff --git a/drivers/video/fbdev/fsl-diu-fb.c b/drivers/video/fbdev/fsl-diu-fb.c index b335c1a..7052200 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; } /* @@ -1915,6 +1918,10 @@ static int __init fsl_diu_init(void) #else monitor_port = fsl_diu_name_to_port(monitor_string); #endif + + if (!diu_ops.set_pixel_clock) + return -ENODEV; + pr_info("Freescale Display Interface Unit (DIU) framebuffer driver\n"); #ifdef CONFIG_NOT_COHERENT_CACHE