From patchwork Wed Feb 9 03:18:46 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Courbot X-Patchwork-Id: 542751 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p193JrHJ012935 for ; Wed, 9 Feb 2011 03:19:54 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756135Ab1BIDTv (ORCPT ); Tue, 8 Feb 2011 22:19:51 -0500 Received: from mail-pv0-f174.google.com ([74.125.83.174]:36692 "EHLO mail-pv0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756105Ab1BIDTv (ORCPT ); Tue, 8 Feb 2011 22:19:51 -0500 Received: by pva4 with SMTP id 4so1272945pva.19 for ; Tue, 08 Feb 2011 19:19:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:from:to:cc:subject:date:message-id:x-mailer; bh=zTCVgE8kME3cN9+Az/0Ec7iKQIpZ3bmxQMhkR4cF0zc=; b=CTWrNoFYB/i4Q+Vpw+FgHTdYI2uv73AWE2s6PLJOzWPxTn0E1NdFkriodabaTaQ/bU AWNdtYwxnSjL1RFwqThJ7JxZZsFwhL8VwlSPP+kJYlNPjy8zIRvy8+mKMZQ4FgSd7SEJ QVZHL5w1iEfvXBPNtJlEJ+60RBHP17gd5N31o= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer; b=k0sWRTptr/bZoWDtRxxcTWOLRPL84y3nG9L6iK8pMeZ8NonrBLRLeie4lFusuMpN+I VXTKveb3uRzKnJ8dSFco/YdEFw+jbdZr5vCAQj1hyMFxGqhgGZAgz+crI0potaxJAUSX DrG8nrvap6VNq7MmyDdhzGYh77evLwygRkwlA= Received: by 10.142.134.9 with SMTP id h9mr5873366wfd.77.1297221590536; Tue, 08 Feb 2011 19:19:50 -0800 (PST) Received: from localhost.localdomain (e0109-114-22-36-42.uqwimax.jp [114.22.36.42]) by mx.google.com with ESMTPS id y42sm759948wfd.10.2011.02.08.19.19.46 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 08 Feb 2011 19:19:48 -0800 (PST) From: Alexandre Courbot To: linux-sh@vger.kernel.org Cc: lethal@linux-sh.org, Alexandre Courbot Subject: [PATCH] serial: sh-sci: prevent setup of uninitialized serial console Date: Wed, 9 Feb 2011 12:18:46 +0900 Message-Id: <1297221526-32283-1-git-send-email-gnurou@gmail.com> X-Mailer: git-send-email 1.7.4 Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Wed, 09 Feb 2011 03:19:54 +0000 (UTC) diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c index 0257fd5..e180bc9 100644 --- a/drivers/tty/serial/sh-sci.c +++ b/drivers/tty/serial/sh-sci.c @@ -1830,6 +1830,12 @@ static int __devinit serial_console_setup(struct console *co, char *options) sci_port = &sci_ports[co->index]; port = &sci_port->port; + /* + * Refuse to handle uninitialized ports. + */ + if (!port->ops) + return -ENODEV; + ret = sci_remap_port(port); if (unlikely(ret != 0)) return ret;