Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp160920pxx; Wed, 28 Oct 2020 01:08:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwl1kuQG9H+gHJO41FFGRj/sORjfAFiYERSaZJn6PaiAF9e7dMLdtpN6mj1cRI55msBmduo X-Received: by 2002:a17:906:3146:: with SMTP id e6mr6059870eje.363.1603872531357; Wed, 28 Oct 2020 01:08:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603872531; cv=none; d=google.com; s=arc-20160816; b=GrFSKS411W7ruKSOu7ty78Es50Rx1A6jD3yj6PjKI9nNbPkkYHDl+4rSoW0uJc676w LeCzJgp2LzJgcjWRl53dyv3+C+TnISL1nuHwev0Zw4x4uvMFcm11O/h2B8HQ/hkRaW8a kWAgZnoO+CkgaelaCL173AoK6xCOdMEiowaSlS0sAeLUG++6BNBOd8WhGVYqR3Xjd4DT coN4iMIuIFjU6bR6l0sU6dS5nKEkUWGLCz9Sg86LXQqFRYEm3DHvkk3rDxDtEo9VeNEr Z1I0dJKkGtK3vU5rNhEmihJbMFv5ykvpj4487ERTbc7kT7yEMOY9tRzbM0k3vtHdybtg IiNQ== 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=ZZPlfjT+w7m4M/lCr9QrZZS4b4iGAMx8XupEv/NyIlw=; b=PLaXoXyDGfaLUHnduhllxvMo/UPdxGfmQZluZ9o7b79/tD2CKBacBZUH80B51ZkCgF xU+GjEFVJyxPePkiks1kGkObwMX7SOQ96idUv56sw6n/zPVYApd2O4Q7XtDwAep+JoPy bZs+HqgKNxnPKDZ8rtWC3WsrZtRjKi6HGdvYb7bLRXYN7YOcjzKkFzEKLqbKiX/J96lE XnXzsi9DdE+Vbcsfd7sz0oqov7VNlf9QyVUtjtmoP9AkG4yO0ekY3r/RgeMNJQ0qCLKZ RqP3RNfp41A+yfszLyr0UhXZpuiZBfteWJT/TtQCsnNWURtCfi3OWudoevH5PvonpVq0 F5PA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Fz6gHLXX; 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 b29si2827715edn.354.2020.10.28.01.08.29; Wed, 28 Oct 2020 01:08:51 -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=Fz6gHLXX; 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 S1753162AbgJ0N6m (ORCPT + 99 others); Tue, 27 Oct 2020 09:58:42 -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 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 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); -- 2.25.1