From patchwork Thu Jul 24 12:02:55 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime COQUELIN X-Patchwork-Id: 34197 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oi0-f70.google.com (mail-oi0-f70.google.com [209.85.218.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id F29D120C7F for ; Thu, 24 Jul 2014 12:04:02 +0000 (UTC) Received: by mail-oi0-f70.google.com with SMTP id u20sf10132517oif.9 for ; Thu, 24 Jul 2014 05:04:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=wGEt+UZKy0E/ulNb1Trb7XK5StX59Ma9R2xy24BY8L4=; b=BTVhKmIHFMyH7z1aqU6zfWsWEqOduVBhqGsnosaNygQTyIfHUE6uvAmofyiFH8OfwU XNk4+VrvML4AgnpN2G8n0O8EIXBwrWENiUjBBrI+fxSgQKRfllUrrP/++GvFgmVHVv+o z+gcJwPvfwijmvDVTUJSkb0RmZ3GEuz2SdhLk4lSeKfMwylhzEv87+PcnBXrRVFsAHru e8gk1aRd/b/9UQdGQ3pImGd5aM+MwVGK4/KFBMZv3XLGAoeq0OuZZsWZLxCm1ivafd6O ODe7agOJvy/W3gvv1yQ27whiHY8ZVKrhKXg0Aiq7SbtJyj4ZU7SRtrB6HyGe492ypzbm XocA== X-Gm-Message-State: ALoCoQny/aAnBHG74Ze1Bl2sN8AF8BIbeXg90VFe1yaljdKYQuZLdlotByGMBJ4fasTbqTCDa2Ss X-Received: by 10.182.111.170 with SMTP id ij10mr3834407obb.6.1406203442532; Thu, 24 Jul 2014 05:04:02 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.51.16.229 with SMTP id fz5ls1202024igd.1.gmail; Thu, 24 Jul 2014 05:04:02 -0700 (PDT) X-Received: by 10.66.174.17 with SMTP id bo17mr9641550pac.98.1406203442375; Thu, 24 Jul 2014 05:04:02 -0700 (PDT) Received: from mail-vc0-f176.google.com (mail-vc0-f176.google.com [209.85.220.176]) by mx.google.com with ESMTPS id sq3si4733357vec.65.2014.07.24.05.04.02 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 24 Jul 2014 05:04:02 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.176 as permitted sender) client-ip=209.85.220.176; Received: by mail-vc0-f176.google.com with SMTP id id10so4665249vcb.7 for ; Thu, 24 Jul 2014 05:04:02 -0700 (PDT) X-Received: by 10.52.37.81 with SMTP id w17mr2625158vdj.95.1406203442243; Thu, 24 Jul 2014 05:04:02 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.37.5 with SMTP id tc5csp358807vcb; Thu, 24 Jul 2014 05:04:01 -0700 (PDT) X-Received: by 10.70.126.98 with SMTP id mx2mr9575591pdb.41.1406203441365; Thu, 24 Jul 2014 05:04:01 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ds16si2895539pdb.219.2014.07.24.05.04.00 for ; Thu, 24 Jul 2014 05:04:01 -0700 (PDT) Received-SPF: none (google.com: linux-kernel-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758732AbaGXMD7 (ORCPT + 13 others); Thu, 24 Jul 2014 08:03:59 -0400 Received: from mx07-00178001.pphosted.com ([62.209.51.94]:34631 "EHLO mx07-00178001.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751558AbaGXMDy (ORCPT ); Thu, 24 Jul 2014 08:03:54 -0400 Received: from pps.filterd (m0046670.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.14.5/8.14.5) with SMTP id s6OBxV4B014861; Thu, 24 Jul 2014 14:03:22 +0200 Received: from beta.dmz-us.st.com (beta.dmz-us.st.com [167.4.1.35]) by mx07-00178001.pphosted.com with ESMTP id 1naxk9s67s-1 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT); Thu, 24 Jul 2014 14:03:22 +0200 Received: from zeta.dmz-us.st.com (ns4.st.com [167.4.16.71]) by beta.dmz-us.st.com (STMicroelectronics) with ESMTP id 3048227; Thu, 24 Jul 2014 12:03:18 +0000 (GMT) Received: from mail7.sgp.st.com (unknown [164.129.223.81]) by zeta.dmz-us.st.com (STMicroelectronics) with ESMTP id 32B9B64; Thu, 24 Jul 2014 12:03:16 +0000 (GMT) Received: from lmenx29l.lme.st.com ([10.201.23.80]) by mail7.sgp.st.com (MOS 4.3.3-GA) with ESMTP id BZR07647 (AUTH lme00137); Thu, 24 Jul 2014 14:03:11 +0200 From: Maxime COQUELIN To: Greg Kroah-Hartman , Jiri Slaby , Srinivas Kandagatla , Patrice Chotard , linux-arm-kernel@lists.infradead.org, linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org Cc: kernel@stlinux.com, maxime.coquelin@st.com Subject: [PATCH 1/2] serial: st-asc: Don't call BUG in asc_console_setup() Date: Thu, 24 Jul 2014 14:02:55 +0200 Message-Id: <1406203376-18203-2-git-send-email-maxime.coquelin@st.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1406203376-18203-1-git-send-email-maxime.coquelin@st.com> References: <1406203376-18203-1-git-send-email-maxime.coquelin@st.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.12.52, 1.0.14, 0.0.0000 definitions=2014-07-24_03:2014-07-24, 2014-07-24, 1970-01-01 signatures=0 Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: maxime.coquelin@st.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.176 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , In order to prevent an asc instance to be used as early console, BUG_ON is used on either mapbase or membase being NULL. Problem is that this condition is also true when we set console to be a ttyASx different to the first asc instance being probed. Instead of calling BUG_ON, it now returns -ENXIO when either mapbase or membase is NULL. Signed-off-by: Maxime Coquelin --- drivers/tty/serial/st-asc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/tty/serial/st-asc.c b/drivers/tty/serial/st-asc.c index f48b1cc..2369bc0 100644 --- a/drivers/tty/serial/st-asc.c +++ b/drivers/tty/serial/st-asc.c @@ -849,7 +849,8 @@ static int asc_console_setup(struct console *co, char *options) * this to be called during the uart port registration when the * driver gets probed and the port should be mapped at that point. */ - BUG_ON(ascport->port.mapbase == 0 || ascport->port.membase == NULL); + if (ascport->port.mapbase == 0 || ascport->port.membase == NULL) + return -ENXIO; if (options) uart_parse_options(options, &baud, &parity, &bits, &flow);