From patchwork Tue Oct 27 13:49:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 290201 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 C6039C388F9 for ; Tue, 27 Oct 2020 13:58:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8483E206D4 for ; Tue, 27 Oct 2020 13:58:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603807118; bh=b5lpMIIZVmL7CbQExB94JKd+NwDlZMs1Eicc7KoKmHc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=dZXfyQRejzgv0R0JT7T9CRJ/BQkkeVbt0VppOdeiOHAkAujVm43QFR3Y6aqHLiHwX JPLW3cu6xjFXwP1tiqB6FhLSdOReoMMwsNbbNbhptFk+9HEqTUXBQpVED4XpphN0NZ AhTVpgD+6W6DFKiF5lexBYGoG3UR/YGqglF/8jgc= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753133AbgJ0N6h (ORCPT ); Tue, 27 Oct 2020 09:58:37 -0400 Received: from mail.kernel.org ([198.145.29.99]:45930 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389512AbgJ0N6g (ORCPT ); Tue, 27 Oct 2020 09:58:36 -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 B232621D42; Tue, 27 Oct 2020 13:58:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603807116; bh=b5lpMIIZVmL7CbQExB94JKd+NwDlZMs1Eicc7KoKmHc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Fz6gHLXXWd93UQ8qLQ3xjXUL4oxaqWVvuZhogUO4NN7rgJ0tgFnyEpv6Go7HfjPZd GrrUIy434Plvmzp6ac1/sVeRWUgp1nQKVriuY1/WkFNctk6z9XCgOrkakWgUo6vMbW 2rwpvk7Pj+7fgaa01RDO/o+ZHa4jIYrYPNv8tTQY= 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.4 048/112] mfd: sm501: Fix leaks in probe() Date: Tue, 27 Oct 2020 14:49:18 +0100 Message-Id: <20201027134902.832329407@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027134900.532249571@linuxfoundation.org> References: <20201027134900.532249571@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 fbec711c41956..0fe273d2f6190 100644 --- a/drivers/mfd/sm501.c +++ b/drivers/mfd/sm501.c @@ -1430,8 +1430,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);