Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp3854512pxv; Mon, 19 Jul 2021 10:19:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyRuCD5KOCLWSzT6H/8BgPmsTn9i4zxBcsFDE4O13C0QaHbARG4QDSB5tDtepfuksZWx6jw X-Received: by 2002:a50:ee98:: with SMTP id f24mr35904158edr.72.1626715151498; Mon, 19 Jul 2021 10:19:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626715151; cv=none; d=google.com; s=arc-20160816; b=pbFWjW46G7VWWGr2tpB4Labd13RYuj86EftOlnJ8tTWir6o/a2o/Hnd08na9VhYXAV LTgn13kS3v/56DL6DKxa5DivbgTUny3tRjom3tMOK0vwORMYhUq1RlalbWDJZh0khDqG tVQtEP3Pc2eyo5m7B/RjNZMn86jdkzMJth6blTcC6VOxmNi6jGDCfY1DZMnd2v3gRYEL VBG7Mh2DQohz4lQNCozowZw36SFXC8ObKkDdiMBfqZqbnTcwBEBcLZTeXKbE5okX7AWF TXpwPHFTJYqhHwSwC0/yZv54/kGgjEG4fg98MbBvx4jN8NeC9sWw5UUQzY4ca1OP4yh9 fFjA== 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=R3xUbCYmVF1Pmk+nRbiBqMIE470z1eDYLPJFG75pXeg=; b=l1oPMSWg/efVmBbw3xxnbWFoQL03QGrGNjgHiyorhPKBc0O0t/nAvjRFxPvp7kfG6b sdp8A8rtHb3pDSTUINne6XdyUWPTd9KnItxO0Dhzm6Azw6WolX/yAKDP4HqJ8DwN7jKt FkSDXyYevfIdeILAuf+HFE+TWk5B+lOyhkbS7645oGEobsQIhKT5AD/psCh2BB5Wqpfw 1o7LuVG2rpT+WzOg3tQmuP+K9aL8C+v1p6fPcUce4Z61Wce4wgH5y1U0GK8rmfcdGaV2 j/tAyc/238id3c1U/PwxbgBYalsGiDcmoIteKuMqUJQWg8He7wFTfxnfbb9c1TAzesd3 vlyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=CcebVu3t; 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 g20si26124587ejm.455.2021.07.19.10.18.48; Mon, 19 Jul 2021 10:19:11 -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=CcebVu3t; 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 S1355661AbhGSQgd (ORCPT + 99 others); Mon, 19 Jul 2021 12:36:33 -0400 Received: from mail.kernel.org ([198.145.29.99]:40238 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348087AbhGSPYe (ORCPT ); Mon, 19 Jul 2021 11:24:34 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id F3ACB61412; Mon, 19 Jul 2021 16:01:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626710483; bh=OgCApF9g4DGMHKRlYaoHVBOoAFpWrb/y9h744UR1QNs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CcebVu3txsqsyWVYWjkri8LR6Mljg7VH4DMgYvx9pbo+JnMMWorc1LV9qpDnDpkHK rffVRviD8HXR/y1RcMIwN2iHasn+mdXkGNHQVPjLg0Um6H5Wrj94MQMnkUabtEXcU7 H/ZJVAiYCpgG71VFJhfLmiIk4jb68D+476fxsi0E= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , Dan Carpenter , Krzysztof Kozlowski , Sasha Levin Subject: [PATCH 5.10 218/243] memory: fsl_ifc: fix leak of IO mapping on probe failure Date: Mon, 19 Jul 2021 16:54:07 +0200 Message-Id: <20210719144947.961556771@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210719144940.904087935@linuxfoundation.org> References: <20210719144940.904087935@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: Krzysztof Kozlowski [ Upstream commit 3b132ab67fc7a358fff35e808fa65d4bea452521 ] On probe error the driver should unmap the IO memory. Smatch reports: drivers/memory/fsl_ifc.c:298 fsl_ifc_ctrl_probe() warn: 'fsl_ifc_ctrl_dev->gregs' not released on lines: 298. Fixes: a20cbdeffce2 ("powerpc/fsl: Add support for Integrated Flash Controller") Reported-by: kernel test robot Reported-by: Dan Carpenter Signed-off-by: Krzysztof Kozlowski Link: https://lore.kernel.org/r/20210527154322.81253-1-krzysztof.kozlowski@canonical.com Signed-off-by: Sasha Levin --- drivers/memory/fsl_ifc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/memory/fsl_ifc.c b/drivers/memory/fsl_ifc.c index 89f99b5b6450..a6324044a085 100644 --- a/drivers/memory/fsl_ifc.c +++ b/drivers/memory/fsl_ifc.c @@ -219,8 +219,7 @@ static int fsl_ifc_ctrl_probe(struct platform_device *dev) fsl_ifc_ctrl_dev->gregs = of_iomap(dev->dev.of_node, 0); if (!fsl_ifc_ctrl_dev->gregs) { dev_err(&dev->dev, "failed to get memory region\n"); - ret = -ENODEV; - goto err; + return -ENODEV; } if (of_property_read_bool(dev->dev.of_node, "little-endian")) { @@ -295,6 +294,7 @@ err_irq: free_irq(fsl_ifc_ctrl_dev->irq, fsl_ifc_ctrl_dev); irq_dispose_mapping(fsl_ifc_ctrl_dev->irq); err: + iounmap(fsl_ifc_ctrl_dev->gregs); return ret; } -- 2.30.2