Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp277429pxx; Wed, 28 Oct 2020 04:49:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwMiG5oRbZteQyDr6gOhwYYXCHo+BpaBYMP6eZerOTYr2fiN2EvG2ZpR8momvhSDAsiQGkN X-Received: by 2002:a17:906:1183:: with SMTP id n3mr6966637eja.188.1603885781830; Wed, 28 Oct 2020 04:49:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603885781; cv=none; d=google.com; s=arc-20160816; b=m9XRPJGJ5Ql77Rz/VmNSzfiP7WpEcVPvNgJyttH72OIKvaA2Gy5a/eV/I11rTsQ4lt 0k62BiI5lC3nkoooBR53oPHNwcGnr1MA1g1B9lv0ADLeQZKQsDiSWamjpr1oRuqS3OKG MDqU3llx/yscUkJK4wqRJm8zZTB5nXEja/K53S5c0Lt3qEzLEQMzF0YIt9AP/YGRP6Tj A2gZGL7mD14uoP+AoMGvMkumhIfLUsFlA/xAdz9nqxNZU8VROCtRSrZeXWB3aNSnILNJ bqGTEmCUefeEBLCrD+uGWXnmG9Ce6BnHJ+SeOoySo/eaxYc3xlrBzBG/3LYfmeKT9N/s x3IQ== 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=oj0lQPV3pOkXlV8CPtAQbxlSe1j71Pnxc7ra+Qy3fOI=; b=a2MhAr38E+oP1u6bTwIxvBJkgQ+bCURNO7akvaJ8i31uiBvrOOlGzrJxLEHALlVGgH haksyNV67p0Giwqti5aby83QiHPZt1QOQPvMVq8onlWQr1yvJMpT3wVDxqQVbP+akreh 7RWdQ8b+VxHCtJTvQX7cDFHHtaeY5eyOWXuVH1l4bQTH+ZiEIl0/sWmEj/BIWqg0SkDS JphMQatwjmf5r+szsmGs2pYBpvhlJidq3L4Itp3c7Eeaw4vulAQEML7lFImZ1zdEQI6p m9avM0iILVg7t5HG5pch0FP/cDxTsgm7yxoy+XeToeUD0xTvUbtxeGxGLrhwV94Si7EB 6ibw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="eqsTLV//"; 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 s18si2795558ejd.147.2020.10.28.04.49.18; Wed, 28 Oct 2020 04:49:41 -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="eqsTLV//"; 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 S1794496AbgJ0PMH (ORCPT + 99 others); Tue, 27 Oct 2020 11:12:07 -0400 Received: from mail.kernel.org ([198.145.29.99]:34882 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1781929AbgJ0PBK (ORCPT ); Tue, 27 Oct 2020 11:01:10 -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 2FDCC22264; Tue, 27 Oct 2020 15:01:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603810868; bh=IlmMQPUl3NAQ4hpgJ5ham64MFJLiMFF5AA3MqQoe3QM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eqsTLV//Q596USk8MR9V/Vurw0Ctm1cHfvA7jiarAQm3YjFb+tNq99wqznG9/uIFa BC0vZ0maLKNScvcVgRQa8nLpb8odLU71s5kjQHYj0bVVU4JiXZOGq9wJXevI1IwQri Wq/dwJLBSwkQCVBu/qqXmCyhJScAhhMT9D7kqBho= 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.8 292/633] mfd: sm501: Fix leaks in probe() Date: Tue, 27 Oct 2020 14:50:35 +0100 Message-Id: <20201027135536.367107791@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027135522.655719020@linuxfoundation.org> References: <20201027135522.655719020@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 ccd62b9639528..6d2f4a0a901dc 100644 --- a/drivers/mfd/sm501.c +++ b/drivers/mfd/sm501.c @@ -1415,8 +1415,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_mem_region(sm->io_res->start, 0x100); err_res: -- 2.25.1