From patchwork Tue Oct 27 13:48:49 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 290102 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 D5CF6C388F9 for ; Tue, 27 Oct 2020 14:12:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 96143218AC for ; Tue, 27 Oct 2020 14:12:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603807967; bh=92lYKycp3LRSuIwpZ+EUNNbI2yKZHwMOSf60O1raYzs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=KHLrz2wNPjRLbo5Pe2iHL7ccOJWmtZvKBVMlqyrERk2RHK4154m0tBPveA8JA35Eq l7vfw3FA9SQxK/usaJSlcgnvTjxU002crW4/Ps42CddAGMG7P+4cuSjpMUINrzDSdq CRB9bn0KQq0JL8TyauWn4etkR+gMDXsfZV6v+xGI= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756345AbgJ0OMp (ORCPT ); Tue, 27 Oct 2020 10:12:45 -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 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 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);