From patchwork Tue Oct 27 13:50:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 312720 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DDEB8C388F9 for ; Tue, 27 Oct 2020 15:07:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 958F321D41 for ; Tue, 27 Oct 2020 15:07:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603811275; bh=IlmMQPUl3NAQ4hpgJ5ham64MFJLiMFF5AA3MqQoe3QM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=k/J8DBSYAJYBcr+C32gaI50aejtkjoHtZoGAN/+rQDs8d7wxRFDIoBrzFuHQRprHc CIrgm4bF6vkHupbwkX1qvBT6M/3rXenWBB/UrsLP7u0xis0CjFbMtNOqTBnjlrOGVr lddWBs5LcUjTrFtq24MNUc1Th/eo8J/W//ETLhTk= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1793698AbgJ0PHw (ORCPT ); Tue, 27 Oct 2020 11:07:52 -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 Precedence: bulk List-ID: X-Mailing-List: stable@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: