Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp2352339pxb; Mon, 20 Sep 2021 19:49:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxRzdbgW9cpitqFatM1X8bgzlk5uiQSUxUWj9rxpGzDEojRYdIXlqTP4e54e2eNgyyM21dZ X-Received: by 2002:a02:3b1b:: with SMTP id c27mr21492301jaa.103.1632192566039; Mon, 20 Sep 2021 19:49:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632192566; cv=none; d=google.com; s=arc-20160816; b=vwmIy5s3QBU5wxtFbYpf21bUCNGT8Wmy6Glw7usyG+7gwDa5eepvXTOMkcdbk86yqW gfdlzj1QAHbD/p9HT9/FnjNUt5opYZZ3LFmBwEv4Csq+TFkPCKTlvFesR8KnPW/IFJuf jfJyog1u54H4GAJmnbQs0jyEfV+KwLjsF1JGOpu0p7s5zlda9dRs7l+nDlBsV6ABZMAs P/jo2rkjJVIxp22DeK/udU0qKg66xob7/02XdB0vbnt8dsIptUKEAr5sfSmoU37cziXj JiuaPX9AmBQDluhUIBgYjq9hvBkNG0vvbyLGFLJ4Cff6NOOmpXF+etQ+cQ5fCdtxwycl F8Mw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=lPNYPD3SaIISDM0MN8lG3p9ha3HJ6It4fJN1+GBsRuE=; b=FLVJHOX359SRO7U4eO1HgErJ2V9D2ZhXo3X4LGU0LUlWWVXVIT1UT9iqUXzwr4HBIN QNjYsZgfJ6bkCyMXy5Zz1deI77AE45MIF36MMqJba2LSGofNRGMGwEMjUnDLs1gLtvy8 cztbAcYmDKDQ0GwpKxo1bf8ZiLKXFEeKgoIVBTLQKuWJHLQhlYqM5fA/IsXP7KlLy6t7 tTjjE3WEqF+TAaxsVs9T/1OxYr9ny+eO4A6cACpnCiIM+nAKKX8wUwLKK0efPFoAigkH f4+kvf4pyY9BARbmog/dELm2arJb7z2tEBtOJwwpKAoid0ohlZt/k3XNA2sN2Qc2YyIY jTbQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Tnl+aFC0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h15si13433717jaa.28.2021.09.20.19.49.14; Mon, 20 Sep 2021 19:49:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Tnl+aFC0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1382303AbhITSkR (ORCPT + 99 others); Mon, 20 Sep 2021 14:40:17 -0400 Received: from mail.kernel.org ([198.145.29.99]:52526 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1381067AbhITSfT (ORCPT ); Mon, 20 Sep 2021 14:35:19 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 7FDB261AAC; Mon, 20 Sep 2021 17:29:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1632158942; bh=6I/5+lZTxVowLex+9DEtwKrtO2w5YLB5jsD+GBWlSsY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Tnl+aFC0ttYVetQTolsakzGV9GC3f3iJtWpH/bTXFd6FHL8FCAPZyF18yzST1q/uj zQM/m4qnplOKc8rkgU/UVwfqDXdh7xZMAcG1iHcY/EZt3nmHjPyKQlawDciFsb+xgi YiFhGzyrgGYsWD4p/FutncM+z+hz6R7VE26SmTq0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe JAILLET , Bartosz Golaszewski , Sasha Levin Subject: [PATCH 5.10 100/122] gpio: mpc8xxx: Fix a potential double iounmap call in mpc8xxx_probe() Date: Mon, 20 Sep 2021 18:44:32 +0200 Message-Id: <20210920163919.067590477@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210920163915.757887582@linuxfoundation.org> References: <20210920163915.757887582@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Christophe JAILLET [ Upstream commit 7d6588931ccd4c09e70a08175cf2e0cf7fc3b869 ] Commit 76c47d1449fc ("gpio: mpc8xxx: Add ACPI support") has switched to a managed version when dealing with 'mpc8xxx_gc->regs'. So the corresponding 'iounmap()' call in the error handling path and in the remove should be removed to avoid a double unmap. This also allows some simplification in the probe. All the error handling paths related to managed resources can be direct returns and a NULL check in what remains in the error handling path can be removed. Fixes: 76c47d1449fc ("gpio: mpc8xxx: Add ACPI support") Signed-off-by: Christophe JAILLET Signed-off-by: Bartosz Golaszewski Signed-off-by: Sasha Levin --- drivers/gpio/gpio-mpc8xxx.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/drivers/gpio/gpio-mpc8xxx.c b/drivers/gpio/gpio-mpc8xxx.c index 5b2a919a6644..a4983c5d1f16 100644 --- a/drivers/gpio/gpio-mpc8xxx.c +++ b/drivers/gpio/gpio-mpc8xxx.c @@ -329,7 +329,7 @@ static int mpc8xxx_probe(struct platform_device *pdev) mpc8xxx_gc->regs + GPIO_DIR, NULL, BGPIOF_BIG_ENDIAN); if (ret) - goto err; + return ret; dev_dbg(&pdev->dev, "GPIO registers are LITTLE endian\n"); } else { ret = bgpio_init(gc, &pdev->dev, 4, @@ -339,7 +339,7 @@ static int mpc8xxx_probe(struct platform_device *pdev) BGPIOF_BIG_ENDIAN | BGPIOF_BIG_ENDIAN_BYTE_ORDER); if (ret) - goto err; + return ret; dev_dbg(&pdev->dev, "GPIO registers are BIG endian\n"); } @@ -378,7 +378,7 @@ static int mpc8xxx_probe(struct platform_device *pdev) if (ret) { pr_err("%pOF: GPIO chip registration failed with status %d\n", np, ret); - goto err; + return ret; } mpc8xxx_gc->irqn = irq_of_parse_and_map(np, 0); @@ -406,9 +406,7 @@ static int mpc8xxx_probe(struct platform_device *pdev) return 0; err: - if (mpc8xxx_gc->irq) - irq_domain_remove(mpc8xxx_gc->irq); - iounmap(mpc8xxx_gc->regs); + irq_domain_remove(mpc8xxx_gc->irq); return ret; } @@ -422,7 +420,6 @@ static int mpc8xxx_remove(struct platform_device *pdev) } gpiochip_remove(&mpc8xxx_gc->gc); - iounmap(mpc8xxx_gc->regs); return 0; } -- 2.30.2