From patchwork Fri Sep 7 02:33:07 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Huang Shijie X-Patchwork-Id: 1418821 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork1.kernel.org (Postfix) with ESMTP id 5669F3FC71 for ; Fri, 7 Sep 2012 02:58:37 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1T9ojs-0005bP-Eo; Fri, 07 Sep 2012 02:56:12 +0000 Received: from db3ehsobe005.messaging.microsoft.com ([213.199.154.143] helo=db3outboundpool.messaging.microsoft.com) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1T9ojo-0005bB-QR for linux-arm-kernel@lists.infradead.org; Fri, 07 Sep 2012 02:56:09 +0000 Received: from mail102-db3-R.bigfish.com (10.3.81.227) by DB3EHSOBE007.bigfish.com (10.3.84.27) with Microsoft SMTP Server id 14.1.225.23; Fri, 7 Sep 2012 02:56:06 +0000 Received: from mail102-db3 (localhost [127.0.0.1]) by mail102-db3-R.bigfish.com (Postfix) with ESMTP id 651FF20198; Fri, 7 Sep 2012 02:56:06 +0000 (UTC) X-Forefront-Antispam-Report: CIP:70.37.183.190; KIP:(null); UIP:(null); IPV:NLI; H:mail.freescale.net; RD:none; EFVD:NLI X-SpamScore: 3 X-BigFish: VS3(zzzz1202h1082kzz8275bhz2dh2a8h668h839hd24he5bhf0ah107ah1288h1155h) Received: from mail102-db3 (localhost.localdomain [127.0.0.1]) by mail102-db3 (MessageSwitch) id 1346986565127783_22171; Fri, 7 Sep 2012 02:56:05 +0000 (UTC) Received: from DB3EHSMHS010.bigfish.com (unknown [10.3.81.236]) by mail102-db3.bigfish.com (Postfix) with ESMTP id 1C94A4200AB; Fri, 7 Sep 2012 02:56:05 +0000 (UTC) Received: from mail.freescale.net (70.37.183.190) by DB3EHSMHS010.bigfish.com (10.3.87.110) with Microsoft SMTP Server (TLS) id 14.1.225.23; Fri, 7 Sep 2012 02:56:04 +0000 Received: from az84smr01.freescale.net (10.64.34.197) by 039-SN1MMR1-002.039d.mgd.msft.net (10.84.1.15) with Microsoft SMTP Server (TLS) id 14.2.309.3; Thu, 6 Sep 2012 21:56:03 -0500 Received: from localhost.localdomain (shlinux2.ap.freescale.net [10.192.224.44]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id q872tuDB014070; Thu, 6 Sep 2012 19:55:57 -0700 From: Huang Shijie To: Subject: [PATCH] serial: mxs-auart: put the device when exit or error Date: Fri, 7 Sep 2012 10:33:07 +0800 Message-ID: <1346985187-30459-1-git-send-email-b32955@freescale.com> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <20120907024349.GH26709@S2101-09.ap.freescale.net> References: <20120907024349.GH26709@S2101-09.ap.freescale.net> MIME-Version: 1.0 X-OriginatorOrg: freescale.com X-Spam-Note: CRM114 invocation failed X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [213.199.154.143 listed in list.dnswl.org] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: linux-kernel@vger.kernel.org, Huang Shijie , linux-serial@vger.kernel.org, shawn.guo@linaro.org, linux-arm-kernel@lists.infradead.org, alan@linux.intel.com X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org We call the get_device() in the mxs_auart_probe(). For the balance of the reference count, we should put the device in the mxs_auart_remove() or in the error path of probe. Signed-off-by: Huang Shijie Acked-by: Shawn Guo --- drivers/tty/serial/mxs-auart.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/drivers/tty/serial/mxs-auart.c b/drivers/tty/serial/mxs-auart.c index 3a667ee..203e512 100644 --- a/drivers/tty/serial/mxs-auart.c +++ b/drivers/tty/serial/mxs-auart.c @@ -781,6 +781,7 @@ out_free_irq: auart_port[pdev->id] = NULL; free_irq(s->irq, s); out_free_clk: + put_device(s->dev); clk_put(s->clk); out_free: kfree(s); @@ -796,6 +797,7 @@ static int __devexit mxs_auart_remove(struct platform_device *pdev) auart_port[pdev->id] = NULL; + put_device(s->dev); clk_put(s->clk); free_irq(s->irq, s); kfree(s);