Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp604243pxx; Wed, 28 Oct 2020 12:11:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyF8b0RQwo2Tjh8LfKo/2MzZ9qQPIuSdfpZe0FtIOqSdPhOm7CxSB0a9AwgODAOa7e+fH0C X-Received: by 2002:aa7:d7c1:: with SMTP id e1mr434229eds.4.1603912305246; Wed, 28 Oct 2020 12:11:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603912305; cv=none; d=google.com; s=arc-20160816; b=KFe2gK3OiqzG1d9DrNYedZfARGZFWicmM/F5a1mffZ3lP2OCNNKhyWaUCO3AuPjQlq I/uEyYLhvNx4lT4gLT/BW/8rohAWhNe2C3e2zkEv5gPWErYBDh/bwQ7yLW9d5eCt0vfs d0Ndnn4vqRh3c2PI7iXa/o+oyodI8iJjknj1M406Naj074IjQUbSZriAmw0elvQakrJB CjcvmRK7ihO9XBK7oxsOKs23Wfxb/J/wjRTC+4bRPiQ8sJi9KXsbVrSuaG9Ng0jU52WI mt32Hih8lxa5m90+rOWs4k8s2PKF+qCo4gPYuQdQ0JzjHRwMdAcEiCwAmB1nxd/q7da2 r2lg== 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=yeBRcLOZJh4rriI96mDMXK5fwTs55v2kSWAhzZAtHDUaewvZ/FjEQRUvkqK8ACvM1z QprW2SSxdLbBJWSRuPAwKVOJptMgEJ5OEok3G3xdWgmOYY9dpeZ1noaYSN6466JLbD93 4SNWQQAzmcb5WUwbij8davDsKAlIzhKek0yQMYGX2yL7Bgh0B/VxEsffS0mF6dWRvUal czIqKWnGkxGt6uJHeWszH6a0zD1UoxwHSWl5PZBMvllGKSLyfnjGcNQGgBh9puzzpjDp AmlYWvscnYjn+0eJv6UpjuZ3jFsWsJonlwIyQs5qro/Ly8w/g+VT3+AO/fcK5d81Kaiv yZ0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ISYeXgNo; 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 w23si165eds.571.2020.10.28.12.11.21; Wed, 28 Oct 2020 12:11:45 -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=ISYeXgNo; 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 S1826345AbgJ0STT (ORCPT + 99 others); Tue, 27 Oct 2020 14:19:19 -0400 Received: from mail.kernel.org ([198.145.29.99]:51938 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2505275AbgJ0ODn (ORCPT ); Tue, 27 Oct 2020 10:03: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 21EA522258; Tue, 27 Oct 2020 14:03:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603807422; bh=92lYKycp3LRSuIwpZ+EUNNbI2yKZHwMOSf60O1raYzs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ISYeXgNoUw/aE+gGBmQcjqWKkdiWl737tDaRTJNboYN+Udb9GzwGazslkqh+vP3eD uioaWYZpMsc6RKRVJmtvhTTbpXSJiQWDuODa1abC3mc1MM4al9xo3DgBBMuR0S63A8 GJ+UQNMKNZw0Ai9iCzpsOQ9N3/tlmBEvi+DYy2Y0= 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.9 048/139] mfd: sm501: Fix leaks in probe() Date: Tue, 27 Oct 2020 14:49:02 +0100 Message-Id: <20201027134904.414857519@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027134902.130312227@linuxfoundation.org> References: <20201027134902.130312227@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