From patchwork Sat Apr 5 14:31:08 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guennadi Liakhovetski X-Patchwork-Id: 3942171 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id E32059F369 for ; Sat, 5 Apr 2014 14:31:48 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 17AE72034C for ; Sat, 5 Apr 2014 14:31:48 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id DC07720265 for ; Sat, 5 Apr 2014 14:31:46 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WWRdG-0001eE-Ju; Sat, 05 Apr 2014 14:31:42 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WWRdE-0005Lp-6R; Sat, 05 Apr 2014 14:31:40 +0000 Received: from moutng.kundenserver.de ([212.227.17.13]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WWRdA-0005L7-Px for linux-arm-kernel@lists.infradead.org; Sat, 05 Apr 2014 14:31:37 +0000 Received: from axis700.grange (dslb-088-076-017-100.pools.arcor-ip.net [88.76.17.100]) by mrelayeu.kundenserver.de (node=mreue101) with ESMTP (Nemesis) id 0MWAht-1WUc5M1CHp-00XLA3; Sat, 05 Apr 2014 16:31:09 +0200 Received: by axis700.grange (Postfix, from userid 1000) id B60B140BB4; Sat, 5 Apr 2014 16:31:08 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by axis700.grange (Postfix) with ESMTP id AA19B40BB3; Sat, 5 Apr 2014 16:31:08 +0200 (CEST) Date: Sat, 5 Apr 2014 16:31:08 +0200 (CEST) From: Guennadi Liakhovetski X-X-Sender: lyakh@axis700.grange To: linux-arm-kernel@lists.infradead.org Subject: [PATCH] serial: amba-pl011: fix regression, causing an Oops on rmmod Message-ID: MIME-Version: 1.0 X-Provags-ID: V02:K0:ucLy3wMkJCSv7cQa6wqWvJjSI40FNxPD/zJ8s2/gieu o5Cw4GiYwS8g26Uxl3y3rmkKcIm+jyvkOXC89LIPDftpv2X1fD DjLIXKw+FyEtoLx4V0C6foGqwTKRMAbDf88Kd5YwqYXbfOadhu 6FHBRU7/a/uEUAX88pDxAtNUk7bAqKelIgiDRzHcAUmGoya6Si EM0YRCHdWDFiRABr58Arwc4L8oTkV357tp8i1UzQ23SvZ2w9b/ JtuCdXbX7w7Gu/uqQcEocv2+5TFddriRLzpwiL5IKdXgH0YXg5 TuWXYxLjsk9x2QCK1BAcXabm4SZAaU5aQd5DGN3c3cGINQO5f3 l/dOljLEIwGwbtdy3G17JWd4lEACHvld+GWZSpY8baDpbk5sbV B0ZCqUByFkDJg== X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140405_103137_085054_C01E7E17 X-CRM114-Status: GOOD ( 11.19 ) X-Spam-Score: -1.9 (-) Cc: Greg KH , linux-serial@vger.kernel.org, Tushar Behera X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.8 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 A recent commit ef2889f7ffee67f0aed49e854c72be63f1466759 "serial: pl011: Move uart_register_driver call to device probe" introduced a regression, causing the pl011 driver to Oops if more than 1 port have been probed. Fix the Oops by only calling uart_unregister_driver() once after the last port has been removed. Signed-off-by: Guennadi Liakhovetski --- drivers/tty/serial/amba-pl011.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c index d4eda24..07325f2 100644 --- a/drivers/tty/serial/amba-pl011.c +++ b/drivers/tty/serial/amba-pl011.c @@ -2176,6 +2176,7 @@ static int pl011_probe(struct amba_device *dev, const struct amba_id *id) static int pl011_remove(struct amba_device *dev) { struct uart_amba_port *uap = amba_get_drvdata(dev); + bool busy = false; int i; uart_remove_one_port(&amba_reg, &uap->port); @@ -2183,9 +2184,12 @@ static int pl011_remove(struct amba_device *dev) for (i = 0; i < ARRAY_SIZE(amba_ports); i++) if (amba_ports[i] == uap) amba_ports[i] = NULL; + else if (amba_ports[i]) + busy = true; pl011_dma_remove(uap); - uart_unregister_driver(&amba_reg); + if (!busy) + uart_unregister_driver(&amba_reg); return 0; }