Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp2354154pxb; Mon, 20 Sep 2021 19:53:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz1XqG4DblS/yOOHRbgcP3H0gfVMMRR4tMVV74DzxOohZLY7QqoGRyv2LBCrS24sd+PnptU X-Received: by 2002:a6b:b842:: with SMTP id i63mr21238284iof.115.1632192796763; Mon, 20 Sep 2021 19:53:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632192796; cv=none; d=google.com; s=arc-20160816; b=cG/hwglmaAO4G+y+wgwrhTTqBTbzi81QEqW6t0YDX75M4IgJaffBDvZg0NSSegvrs7 NPRAKpDP9GZCrtRNgcQxy5XiBvY+L+wUBaW0bkzlrB5HfGedCjWF2CCKpF/B/iZdtPPx KjcQcf6jRtM12Ld3gaBh6L15k/1iM8auSzEyDQVzn21rHmrxt/bg3/G6TOeOKBh5S0Ge efATE77C1o2b6Y9DKlqzNQPG3mlLz2R3pFDGNYmvLymLRdVxZZ4juk5iYdc1ZfmVMN0D RdLMkrOQ10AskslsamoN11tmzqiORijup2BwFooU85prllw19gkNN1I8v4W+bKjR+1hm WpHg== 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=Cofuu4At++upQuQKQTN4m01QkjicdYG63Vc59nrMewI=; b=TJdocsNS/FqkcU2U0CZNPtdB2HF94dntuOokjCqnrXRhWSsry5ioS5yL9MHBfrPGsS ARKdOWXtPi6BQY2xzszejRO9vjOcTBJtB8bEjh4EwnoFR/xhU0CIyCc1eOsMRyfpi1Gy jk3/9K+U4FgXFoXHC3n7mSir4Yoc/mWOkXBnXjlw7H7XJWyNXnJULjypKsEi8mTEQNQa 9CSL+BUURuhkSxCn5/n1rHeB+d4BHwLAu8TWG5C8XPuB2QgcXk9JgcCpB/iqWoc2PDpw kzKVnAv6aZ5af7fQHUBwPfjeVgNL6pkzlZ1kKMpjSUYPh9lIe39KvEMGl3NyrcGYcw/V MnAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=d5NdF7YO; 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 k26si7972996ioh.55.2021.09.20.19.53.05; Mon, 20 Sep 2021 19:53:16 -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=d5NdF7YO; 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 S1387186AbhITS6d (ORCPT + 99 others); Mon, 20 Sep 2021 14:58:33 -0400 Received: from mail.kernel.org ([198.145.29.99]:33338 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1384584AbhITSs1 (ORCPT ); Mon, 20 Sep 2021 14:48:27 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id DF9FB63379; Mon, 20 Sep 2021 17:34:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1632159246; bh=bctpGfzMw5o3U7ExE35/OvyYBNCX8ZGZmwVaVROj7KU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=d5NdF7YOXyUkrAHC1to6UkBLcujbq5sQJMbFwqggagtb2xgwJ1gJ61HhjeI42MOAD 8jYL6bJzHRoFuQIdPiNm6wkN+ftctM/bo3qkTyWuztsxb31OGrTKHD84Dq7ourcKAN HiOJ8kU2EA3pTyajWz3h4wG8Sl+uuWlViutKHeEc= 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.14 144/168] gpio: mpc8xxx: Fix a potential double iounmap call in mpc8xxx_probe() Date: Mon, 20 Sep 2021 18:44:42 +0200 Message-Id: <20210920163926.393311485@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210920163921.633181900@linuxfoundation.org> References: <20210920163921.633181900@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 9acfa25ad6ee..fdb22c2e1085 100644 --- a/drivers/gpio/gpio-mpc8xxx.c +++ b/drivers/gpio/gpio-mpc8xxx.c @@ -332,7 +332,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, @@ -342,7 +342,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"); } @@ -384,7 +384,7 @@ static int mpc8xxx_probe(struct platform_device *pdev) if (ret) { dev_err(&pdev->dev, "GPIO chip registration failed with status %d\n", ret); - goto err; + return ret; } mpc8xxx_gc->irqn = platform_get_irq(pdev, 0); @@ -416,9 +416,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; } @@ -432,7 +430,6 @@ static int mpc8xxx_remove(struct platform_device *pdev) } gpiochip_remove(&mpc8xxx_gc->gc); - iounmap(mpc8xxx_gc->regs); return 0; } -- 2.30.2