From patchwork Thu Jul 9 13:56:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chuhong Yuan X-Patchwork-Id: 11654459 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 240D0913 for ; Thu, 9 Jul 2020 13:58:02 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id F12E620708 for ; Thu, 9 Jul 2020 13:58:01 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="ZcMKuAAZ"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="gfE8rgv9" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F12E620708 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=PhP+CVSVtQbCBAWy0E4cq9YmbVJjDr3SlQvixefgoVI=; b=ZcMKuAAZ5FR/EF6tDCFGSr6GBA ecHE14Afrh2rihpoJ477L5ZKPbjwB7Po5XJrNu3PIW8raCD2CBXR7cFsw0ZCjhy4hGTA88xpVLeYg z4uZQkKFt7aWQIn0hz5P7XrykDOJk1U8ohqPl1cGtQVKwQgaG9G5+ztnR2PZRZOO8TW9Cwf+D+HXl eoMD62zX9Jx5GqeTrTCSnxn8l5/jQzzSdGXZDE3XAwdO8tY8CbsP2bW2nzjFxskz5JtKRRUnFpkeJ v6LlevSGVeSQQJ+g9rvPkaI+G6HTRjW5OM5S6mO4R6bFicVH/EimY/d7uStDBbxcFN0Y4M9xpnjwF 8ZEFU8GA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jtX2G-0007j3-0I; Thu, 09 Jul 2020 13:56:24 +0000 Received: from mail-pf1-x442.google.com ([2607:f8b0:4864:20::442]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jtX2D-0007i8-QX for linux-arm-kernel@lists.infradead.org; Thu, 09 Jul 2020 13:56:22 +0000 Received: by mail-pf1-x442.google.com with SMTP id t11so1041239pfq.11 for ; Thu, 09 Jul 2020 06:56:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=h558bNdz+ALdoIojIxtZwctE+fRhBkDe5PAZGaAvP6U=; b=gfE8rgv9qIBnyKW/75JmtNyFErM6yZ/5v1BNZp17ZRVhmLS6VD6T/MsryG9qTXczSg LyphMEP2M7vaMSN6luQGosY5Y6sXO3rhFBUK9iJZKMygJafb8Ob+qKyTOmiW9CQgGhIx cKizsEU/JGEFzrxuZ2Zsg8FTM2r3O1Arhx7EwyPNQSsXeYr7c8+wzYKlV6i61VOgv7n9 A4O2EdKUzmOtRTxMCEa6l7Bz9UWSPEPS1TShhwyr0e++5w3WK4697xaqh2Q4ae7du9Rz 18mRIuv/+m/kwjDSupZ5ykxqyU+y5C/f3QaxcsOknGEnZ6iiTeWa7vLNFKAP7XkvU50B cPxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=h558bNdz+ALdoIojIxtZwctE+fRhBkDe5PAZGaAvP6U=; b=RxJkY50QkBqftsUVxZW339b/xbQOtUr39gbjQhFpLKjj1KgWtt1KKMsn3RwBJwVNPZ Z6/eJdwHORny9LUIJW0sF9E6ahmdjhTN/lwbLHVdWttOA28GU+i9riGdCnzHPz5w12sU v8wBbMjite9jTsayQ6mtEQPYs2uJAEhOdqOIo1S4dkrrLPEJ5SJUGJp16ELn2e/bfUGE p2sbxZ/SkR3axxz/5g5IGt8HN8000mgb3x3ApUtuFt5OClSCmhXoqfHwSLwyP8dWpJmi D4xb3IS8rCoQGmashLTIm3cEvMnvA/Rhj5135GLicl2K9rZO9+0q9Vk6zdC/M666KE/L JqNA== X-Gm-Message-State: AOAM533MSD3SJOy9Fet++6PjSJhsD5KbEYM+0JoNvIbgGKFnXhRqLPh7 75K5s1739a6pVD5OEHsDdAs= X-Google-Smtp-Source: ABdhPJx9jxxv75YnWC6v4T0SESzp6aFF4h7ok+oXm33OzoALrK0dC2u3FzFw0Oi6J/lLKcld3amVmg== X-Received: by 2002:a62:84d5:: with SMTP id k204mr54550112pfd.66.1594302978512; Thu, 09 Jul 2020 06:56:18 -0700 (PDT) Received: from suzukaze.ipads-lab.se.sjtu.edu.cn ([202.120.40.82]) by smtp.gmail.com with ESMTPSA id o129sm2474929pfg.14.2020.07.09.06.56.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Jul 2020 06:56:17 -0700 (PDT) From: Chuhong Yuan To: Subject: [PATCH v2] serial: mxs-auart: add missed iounmap() in probe failure and remove Date: Thu, 9 Jul 2020 21:56:08 +0800 Message-Id: <20200709135608.68290-1-hslester96@gmail.com> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200709_095621_876802_9A488368 X-CRM114-Status: GOOD ( 12.86 ) X-Spam-Score: 1.6 (+) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (1.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- 1.5 RCVD_IN_SORBS_WEB RBL: SORBS: sender is an abusable web server [202.120.40.82 listed in dnsbl.sorbs.net] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.2 FREEMAIL_ENVFROM_END_DIGIT Envelope-from freemail username ends in digit [hslester96[at]gmail.com] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [hslester96[at]gmail.com] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:442 listed in] [list.dnswl.org] -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-serial@vger.kernel.org, Greg Kroah-Hartman , Sascha Hauer , Chuhong Yuan , linux-kernel@vger.kernel.org, NXP Linux Team , Pengutronix Kernel Team , Jiri Slaby , Shawn Guo , Fabio Estevam , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org This driver calls ioremap() in probe, but it misses calling iounmap() in probe's error handler and remove. Add the missed calls to fix it. Fixes: 47d37d6f94cc ("serial: Add auart driver for i.MX23/28") Signed-off-by: Chuhong Yuan --- Changes in v2: - Use iounmap() instead of devm_ioremap() to fix the bugs. - Modify the subject and the description. drivers/tty/serial/mxs-auart.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/tty/serial/mxs-auart.c b/drivers/tty/serial/mxs-auart.c index b4f835e7de23..b784323a6a7b 100644 --- a/drivers/tty/serial/mxs-auart.c +++ b/drivers/tty/serial/mxs-auart.c @@ -1698,21 +1698,21 @@ static int mxs_auart_probe(struct platform_device *pdev) irq = platform_get_irq(pdev, 0); if (irq < 0) { ret = irq; - goto out_disable_clks; + goto out_iounmap; } s->port.irq = irq; ret = devm_request_irq(&pdev->dev, irq, mxs_auart_irq_handle, 0, dev_name(&pdev->dev), s); if (ret) - goto out_disable_clks; + goto out_iounmap; platform_set_drvdata(pdev, s); ret = mxs_auart_init_gpios(s, &pdev->dev); if (ret) { dev_err(&pdev->dev, "Failed to initialize GPIOs.\n"); - goto out_disable_clks; + goto out_iounmap; } /* @@ -1720,7 +1720,7 @@ static int mxs_auart_probe(struct platform_device *pdev) */ ret = mxs_auart_request_gpio_irq(s); if (ret) - goto out_disable_clks; + goto out_iounmap; auart_port[s->port.line] = s; @@ -1746,6 +1746,9 @@ static int mxs_auart_probe(struct platform_device *pdev) mxs_auart_free_gpio_irq(s); auart_port[pdev->id] = NULL; +out_iounmap: + iounmap(s->port.membase); + out_disable_clks: if (is_asm9260_auart(s)) { clk_disable_unprepare(s->clk); @@ -1761,6 +1764,7 @@ static int mxs_auart_remove(struct platform_device *pdev) uart_remove_one_port(&auart_driver, &s->port); auart_port[pdev->id] = NULL; mxs_auart_free_gpio_irq(s); + iounmap(s->port.membase); if (is_asm9260_auart(s)) { clk_disable_unprepare(s->clk); clk_disable_unprepare(s->clk_ahb);