Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4597262pxj; Wed, 12 May 2021 08:57:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxMG2uBnDARM1bDhzweIIiifzD0HllGnCX86QEfOgzmQ+zwt6Xqke+sw4/ku36Mp9iR2oyk X-Received: by 2002:a4a:b785:: with SMTP id a5mr2737526oop.75.1620835058542; Wed, 12 May 2021 08:57:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620835058; cv=none; d=google.com; s=arc-20160816; b=Z0f1g5DklDnDG8po5v2negnn6Exu0056sOZROSKOB3cLLevLTMCCvFqjQSFfMX5ghb EzMtBlDKHs5NziYhLAn6AoqnA74aYlCHKHlDM9hpq/HeQWhjux7BSWQKHWg5OYzYP46D 36e6HcL2ykl/zLHLf/81ZgnCuOSJmg3VEKs2+Gh7SXsHsms0K9aP+1SsuZve7Q+DNrno 5MLHSUimhGeqOo/nhlmwjx0qUJPcQe5bx9NyNCg4flMD2dn3cyTSS2yaLQNV6vB+m7cI kW2hUJpEc6zRsOxzxmBOSKqAHQ3L0Wk3rv3++UD7ilmY/4qmUEiL3E//DyxldtB9vVcN 2TGA== 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=BeTR3lIMAgVroocxVBJSfOCUQ0rImfOdFP1D0lMgunI=; b=mYwY82jE+v8mqj0+aO9wYW5WzAHDdGrIQjcgRQv2ZkNAoBrKwjMTHjxzAFg9cm//hK E0zLK26rSurPg00gHuOm5M7vS2R9ZU07WBD7ZCHDzbePc2C2id5Sk2uSBqRF2paySu/G pOy5+VpKyA5fB5Y+x0oRVq2Ak0UKVseJa3FbmoTkY9BYnbErsHvK/7BVkDF7Eu2bIdwq fLx4eIwAqp6ZrHuJx/G0pwdQmivXTtN5WRanjMm1ISzJ58WFd07YXIXuMTsHyjPKu32z duQl/GNDOaPcV+BHzA2wr3jEQYh/bLRlI+XWKDSjpu70d4VLPCS0YCJVv0vpEHunXkL8 FILA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=KOJO494g; 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 w110si222451otb.53.2021.05.12.08.57.25; Wed, 12 May 2021 08:57:38 -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=KOJO494g; 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 S238180AbhELP53 (ORCPT + 99 others); Wed, 12 May 2021 11:57:29 -0400 Received: from mail.kernel.org ([198.145.29.99]:38784 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235372AbhELP1k (ORCPT ); Wed, 12 May 2021 11:27:40 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id C59D161A3E; Wed, 12 May 2021 15:12:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620832359; bh=AyiY6eYCrjZnOf5dCrV6b3n1uTECJh8Bs5Nv1zQA1xw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KOJO494gakrSXRPvLas3+/sOmYKdRQRELrw1Kcz9ENAqJS5KdVKTnfGBFt3Eahpf1 90Wd9GMQeEgKVYCBRhRaYlRi83wPXzIRuo9sgArfz/loe4eyqCHLnSXLy3zfsUku0Y MtC2llDVXj65TzZ4KBL5aZZI1VSJAAmzLLGAfxCA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hulk Robot , Yang Yingliang , Mark Brown , Sasha Levin Subject: [PATCH 5.10 220/530] spi: fsl: add missing iounmap() on error in of_fsl_spi_probe() Date: Wed, 12 May 2021 16:45:30 +0200 Message-Id: <20210512144827.066006348@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210512144819.664462530@linuxfoundation.org> References: <20210512144819.664462530@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: Yang Yingliang [ Upstream commit 5fed9fe5b41aea58e5b32be506dc50c9ab9a0e4d ] Add the missing iounmap() before return from of_fsl_spi_probe() in the error handling case. Fixes: 0f0581b24bd0 ("spi: fsl: Convert to use CS GPIO descriptors") Reported-by: Hulk Robot Signed-off-by: Yang Yingliang Link: https://lore.kernel.org/r/20210401140350.1677925-1-yangyingliang@huawei.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- drivers/spi/spi-fsl-spi.c | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/drivers/spi/spi-fsl-spi.c b/drivers/spi/spi-fsl-spi.c index e4a8d203f940..d0e5aa18b7ba 100644 --- a/drivers/spi/spi-fsl-spi.c +++ b/drivers/spi/spi-fsl-spi.c @@ -707,6 +707,11 @@ static int of_fsl_spi_probe(struct platform_device *ofdev) struct resource mem; int irq, type; int ret; + bool spisel_boot = false; +#if IS_ENABLED(CONFIG_FSL_SOC) + struct mpc8xxx_spi_probe_info *pinfo = NULL; +#endif + ret = of_mpc8xxx_spi_probe(ofdev); if (ret) @@ -715,9 +720,8 @@ static int of_fsl_spi_probe(struct platform_device *ofdev) type = fsl_spi_get_type(&ofdev->dev); if (type == TYPE_FSL) { struct fsl_spi_platform_data *pdata = dev_get_platdata(dev); - bool spisel_boot = false; #if IS_ENABLED(CONFIG_FSL_SOC) - struct mpc8xxx_spi_probe_info *pinfo = to_of_pinfo(pdata); + pinfo = to_of_pinfo(pdata); spisel_boot = of_property_read_bool(np, "fsl,spisel_boot"); if (spisel_boot) { @@ -746,15 +750,24 @@ static int of_fsl_spi_probe(struct platform_device *ofdev) ret = of_address_to_resource(np, 0, &mem); if (ret) - return ret; + goto unmap_out; irq = platform_get_irq(ofdev, 0); - if (irq < 0) - return irq; + if (irq < 0) { + ret = irq; + goto unmap_out; + } master = fsl_spi_probe(dev, &mem, irq); return PTR_ERR_OR_ZERO(master); + +unmap_out: +#if IS_ENABLED(CONFIG_FSL_SOC) + if (spisel_boot) + iounmap(pinfo->immr_spi_cs); +#endif + return ret; } static int of_fsl_spi_remove(struct platform_device *ofdev) -- 2.30.2