Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp188902pxx; Wed, 28 Oct 2020 02:09:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzdY5ewTalpRq/ee9H4TRxQ3B0J8GO1EGYcFC7lEYIYjjgszG7MxQzjHfmvmBvdhvGcsRnT X-Received: by 2002:aa7:d582:: with SMTP id r2mr6461495edq.170.1603876192689; Wed, 28 Oct 2020 02:09:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603876192; cv=none; d=google.com; s=arc-20160816; b=WuF1X+I9v5ofh25E2gwh3g0rOld3Dn4eWQRb/OxqlpGf6Agkz9cN/dZQecYDkj8aKY /Ns1+NB6rD2FbEjvxB2ENZWQmra95ssCLc2tZ2wpi/ke0Y6WW7KiMHaC6RpvHlx4VTxF LK2vDN/EV7agn5Jk+JX+xrhCcLEC5kcB2qSZK/JZ/ADZBTnhtSfwB7k9jPIfjzao6G2m dtMnV5BaSutdak22glHT8t0doRblNTNtZVupsNZWaG6pCvugBZ2crGpODQqhZpv4e3wr AbBk4Ta4CsxZcc0OaLebdRSvSvWt2DaTebcEFCcMN997eyLIl11sAxeP9QTOzJ5qxRnK YBIQ== 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=pJDUF5bkRAj+zh4XrRwYj8pT4Xih5mmLzlf8iK51F8U=; b=LNiLYYIw022d2i+nX6vGBPhkmHuHVqHhmD6m6YZ8gZ99r6Pp62Yx8Wp7vOXa5g/nA1 eP0G6jHUKBOGhqG8zhsrzTmHLF1oBFBo7Iez+0vIrb22lEs4xXYzD3/ABagjj6k3l+qM S0ZxN1cykK7BNukYddquW4vOWmwB3mbmAq0W4sajTTm9i3EPxnF6p9J7OyK96Qa5ADyy UjkJyJIfeB27Jj+aEIGjtVayrNzZGSmXJuwXdudLxylIZwdqUD9/J3yISulDC4a/KByr jicEeJGKJ+TsdFaDqGLnYlJG1t219lLjIyIQnDCfngDF5Spxju0ayDkEB39r/3gNMj7h 46AA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=1diPobV5; 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=fail (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 o10si2705925ejr.482.2020.10.28.02.09.30; Wed, 28 Oct 2020 02:09:52 -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=@kernel.org header.s=default header.b=1diPobV5; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757177AbgJ0OQg (ORCPT + 99 others); Tue, 27 Oct 2020 10:16:36 -0400 Received: from mail.kernel.org ([198.145.29.99]:33976 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756339AbgJ0OMn (ORCPT ); Tue, 27 Oct 2020 10:12:43 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id ACD22218AC; Tue, 27 Oct 2020 14:12:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603807962; bh=92lYKycp3LRSuIwpZ+EUNNbI2yKZHwMOSf60O1raYzs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1diPobV5KqtebCWesO6eer20B+stZSuq2R9s6RQ2jtGF1ZYFUo64o2yH9ckKPlVp0 7VFqDu6ML7WWZ6JhJesftlrJ+cNZ2XNXzb+nzNOJKo+i3mae30WDnbc/j5PWx6bOav KOoWBZh0DH0xeypnQH2QVjLEnb31kRFvycU1IRlQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Lee Jones , Sasha Levin Subject: [PATCH 4.14 074/191] mfd: sm501: Fix leaks in probe() Date: Tue, 27 Oct 2020 14:48:49 +0100 Message-Id: <20201027134913.270341651@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027134909.701581493@linuxfoundation.org> References: <20201027134909.701581493@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: Dan Carpenter [ Upstream commit 8ce24f8967df2836b4557a23e74dc4bb098249f1 ] This code should clean up if sm501_init_dev() fails. Fixes: b6d6454fdb66 ("[PATCH] mfd: SM501 core driver") Signed-off-by: Dan Carpenter Signed-off-by: Lee Jones Signed-off-by: Sasha Levin --- drivers/mfd/sm501.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/mfd/sm501.c b/drivers/mfd/sm501.c index 3270b8dbc9498..4ca245518a199 100644 --- a/drivers/mfd/sm501.c +++ b/drivers/mfd/sm501.c @@ -1425,8 +1425,14 @@ static int sm501_plat_probe(struct platform_device *dev) goto err_claim; } - return sm501_init_dev(sm); + ret = sm501_init_dev(sm); + if (ret) + goto err_unmap; + + return 0; + err_unmap: + iounmap(sm->regs); err_claim: release_resource(sm->regs_claim); kfree(sm->regs_claim); -- 2.25.1