From patchwork Tue Jul 19 02:24:48 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Haojian Zhuang X-Patchwork-Id: 988082 Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p6J2Y1jc000848 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Tue, 19 Jul 2011 02:34:22 GMT Received: from canuck.infradead.org ([134.117.69.58]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1Qj07x-0003pV-NY; Tue, 19 Jul 2011 02:33:43 +0000 Received: from localhost ([127.0.0.1] helo=canuck.infradead.org) by canuck.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1Qj07x-0003PF-Bq; Tue, 19 Jul 2011 02:33:41 +0000 Received: from dakia2.marvell.com ([65.219.4.35]) by canuck.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1Qj06R-00037S-0N for linux-arm-kernel@lists.infradead.org; Tue, 19 Jul 2011 02:32:08 +0000 X-ASG-Debug-ID: 1311042726-082edac60001-tbGyMd Received: from maili.marvell.com (maili.marvell.com [10.68.76.51]) by dakia2.marvell.com with ESMTP id mFVpbw5l4aQYmefL; Mon, 18 Jul 2011 19:32:06 -0700 (PDT) X-Barracuda-Envelope-From: haojian.zhuang@marvell.com Received: from localhost (unknown [10.38.164.65]) by maili.marvell.com (Postfix) with ESMTP id A3A6E8A002; Mon, 18 Jul 2011 19:32:05 -0700 (PDT) From: Haojian Zhuang To: haojian.zhuang@gmail.com, grant.likely@secretlab.ca, linux-arm-kernel@lists.infradead.org, devicetree-discuss@lists.ozlabs.org, nico@fluxnic.net, alan@linux.intel.com, eric.y.miao@gmail.com, linux@arm.linux.org.uk, khali@linux-fr.org, ben-linux@fluff.org X-ASG-Orig-Subj: [PATCH 5/7] tty: serial: check ops before registering console Subject: [PATCH 5/7] tty: serial: check ops before registering console Date: Tue, 19 Jul 2011 10:24:48 +0800 X-ASG-Orig-Subj: [PATCH 5/7] tty: serial: check ops before registering console Message-Id: <1311042290-20253-6-git-send-email-haojian.zhuang@marvell.com> X-Mailer: git-send-email 1.5.6.5 In-Reply-To: <1311042290-20253-5-git-send-email-haojian.zhuang@marvell.com> References: <2011071901> <1311042290-20253-1-git-send-email-haojian.zhuang@marvell.com> <1311042290-20253-2-git-send-email-haojian.zhuang@marvell.com> <1311042290-20253-3-git-send-email-haojian.zhuang@marvell.com> <1311042290-20253-4-git-send-email-haojian.zhuang@marvell.com> <1311042290-20253-5-git-send-email-haojian.zhuang@marvell.com> X-Barracuda-Connect: maili.marvell.com[10.68.76.51] X-Barracuda-Start-Time: 1311042726 X-Barracuda-URL: http://10.68.76.222:80/cgi-mod/mark.cgi X-Barracuda-Spam-Score: -1002.00 X-Barracuda-Spam-Status: No, SCORE=-1002.00 using global scores of TAG_LEVEL=1000.0 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=1000.0 X-CRM114-Version: 20090807-BlameThorstenAndJenny ( TRE 0.7.6 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20110718_223207_224254_5261CD76 X-CRM114-Status: GOOD ( 12.43 ) X-Spam-Score: -1.1 (-) X-Spam-Report: SpamAssassin version 3.3.1 on canuck.infradead.org summary: Content analysis details: (-1.1 points) pts rule name description ---- ---------------------- -------------------------------------------------- -1.1 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain Cc: Haojian Zhuang X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Tue, 19 Jul 2011 02:34:22 +0000 (UTC) Console should be only registered after port->ops assigned. If uart console doesn't match the current uart, port->ops keeps NULL. Signed-off-by: Haojian Zhuang --- drivers/tty/serial/pxa.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/tty/serial/pxa.c b/drivers/tty/serial/pxa.c index 8f4d538..2d8e7d0 100644 --- a/drivers/tty/serial/pxa.c +++ b/drivers/tty/serial/pxa.c @@ -684,7 +684,7 @@ serial_pxa_console_setup(struct console *co, char *options) if (co->index == -1 || co->index >= serial_pxa_reg.nr) co->index = 0; up = serial_pxa_ports[co->index]; - if (!up) + if (!up || !up->port.ops) return -ENODEV; if (options)