Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp221612pxx; Wed, 28 Oct 2020 03:15:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzYfeqAJJROsGWSKsdQ81BjSQQ+oXgitCu7n7puHVynRfVch9i+hB6gVoP9oGklUaHfECdm X-Received: by 2002:a17:906:3614:: with SMTP id q20mr6516109ejb.297.1603880111371; Wed, 28 Oct 2020 03:15:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603880111; cv=none; d=google.com; s=arc-20160816; b=zqMWCOmd6Lyq9p60xTIDzI+Q7sJyt11r01ViJw6CTpW/C9eceQbc+VoAda3rXJhyeZ we+AiMtslQsjJg4nCeQgma1KqsqODE208dScBhD28Xa2rbVjnPZW0/35VsIdY1VLNcYh Q7VAcKEIOZq8G+dyp+8qVqshnceQosDUoYsboSyH3GrhG7i7nU8QNIndAYCmxaq2+pHY OoA2uv4Y0Nec5Z+v78dvhQ2shu/dvM1qeY0J7say5Fp9CpLFSmaaKdubjHXL84AUu7wT KIrsscJ1Xk/zDI/B9eXDRekPc+zePNSATYXd6xqr6NmV31oX/O46cldNCaySLwdivZD1 6NAw== 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=GglbgeQz+bMPGG8XgCkHfMoV1onaaiySrSEoyuk8sKw=; b=IEG1QviGkmEJEGDKoGqV3bzKKAJ6208wUIx7B/UKCdLbxc+lLaI+MiGUYBiCtNfOw0 5yHfQNvJpNJz36FLaVv7qiX+YSu4j9H5OWrYfEoHL2Pj8V3k+63FGyin+S598HMJ4fdy PlV/LvWJGiErL4CsMUN+Sid8QQo4os2bDFnjD+2WLGIbHU3eCeknjSOwS6pQV6S2gnZV p4i2qkZj8jn0aZcQqUi3MmQ7ZLHwa2FAZvsX2cxNVvbEBif0D3jqv8R4WTzFfcF4gCLj x4vadyzZZdlRray97w0GWEatGMg/PiVmBB6OBa4HLpFMlT7MAIdo9TGCj9OUIJz2yhbY 2cMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=OQZaGdfi; 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 l12si2820211edk.163.2020.10.28.03.14.49; Wed, 28 Oct 2020 03:15: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=@kernel.org header.s=default header.b=OQZaGdfi; 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 S1760874AbgJ0Ogy (ORCPT + 99 others); Tue, 27 Oct 2020 10:36:54 -0400 Received: from mail.kernel.org ([198.145.29.99]:35390 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1760792AbgJ0Oga (ORCPT ); Tue, 27 Oct 2020 10:36:30 -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 EB67C22202; Tue, 27 Oct 2020 14:36:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603809389; bh=E2lVoZPmw/mZoa8vzVe9Oe1Sn3u000mDTbCd64MEIR8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OQZaGdfiXRLkciwoGt9jI/pE6daZW/eq1eCWULW+gBufG0x8QpcFZ2I1Zl6hDXahI EaolOokpQQbjFbY/MKpzOYSeYNpBwub/Fyli8dBFUAKYvdsvshi5tUUs3G3wnzU6tN Jz00C/wjc6OBCsVXpTEEC2HJafeF2BAmhG9yWXJg= 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 5.4 177/408] mfd: sm501: Fix leaks in probe() Date: Tue, 27 Oct 2020 14:51:55 +0100 Message-Id: <20201027135503.308033744@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027135455.027547757@linuxfoundation.org> References: <20201027135455.027547757@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 154270f8d8d78..bbcde58e2a11e 100644 --- a/drivers/mfd/sm501.c +++ b/drivers/mfd/sm501.c @@ -1424,8 +1424,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