Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp3995448pxu; Mon, 12 Oct 2020 06:57:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxHgooCczTiwy53aRF0BVa1Q9iGAJ+a26GIXR8CqFY3LxMDBwXmf279WuhlUya7ZVmCMYQn X-Received: by 2002:aa7:c38b:: with SMTP id k11mr14433284edq.33.1602511055833; Mon, 12 Oct 2020 06:57:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602511055; cv=none; d=google.com; s=arc-20160816; b=egPoI7knhHXI5uNnsgmRuXpUtg8aq9iMn6xpDWgvhNSqAnIcGZJ8nzLgH4Lb0b6yKD Rh/8aLt/YAJIB70bmE4sCoT2SwNfpbkNuWbD9b7E8dMTtfNETK0DoJciw2QazRcnIevX uFKxV2sR5X49YJ8DiPzMduv9oSF2GCn2RlpDCGZppS0zOS1g4O2fitnKF1EFLEPJ/QuT hDinX/p1V2WWuA5waOaZpliztXOP/yA1K83zcl+ElBnBU4UUGrPedpegnoOtK5zgs9qg BMH9+jn/zju4+zPRJKXVxtd+WCUKQ/iJ9sEyl1Q2zJLMsxsTdgQWGE2yqpB7Ko5086SP 10GQ== 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=iqjX/669pc4srI6dbMQNSN7sywg4d4EJ9slgqtVlsAo=; b=bF1QkmeEcilgIUyV6ksu1CUzBTQxnLmzHhDiz4Y+BkbD1xLKwdRuAIMh+fh6FAR9VF 9GQsuKlnaK86VYJvGqjrRKXj/h8TnQzEKyO2DLy2RQiD+mvbQzQb0QuyrBRbimHuXdgI xoj+rY+QGToRUG7GB+ff2ySCT1WYDq9LPk0PUD91w96/efxN5QbPIZK2jw1480K3Ni+F /DxMupP/znLtr/AarpKSHPM3jmmctrrHHfpse3wjUKZ2TszLXcxEv7aZoDFJFSShVpP7 BOYAocE7f4kDTdq6dWBrKO6o4N0I9+Ob6bWmqeWgkJl4XTnn7XRw9wsu6UP3q4c5uBFE BhHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="F/5aYKhs"; 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 bg11si11079919ejb.200.2020.10.12.06.57.12; Mon, 12 Oct 2020 06:57:35 -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="F/5aYKhs"; 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 S2390490AbgJLNzW (ORCPT + 99 others); Mon, 12 Oct 2020 09:55:22 -0400 Received: from mail.kernel.org ([198.145.29.99]:46218 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389660AbgJLNpl (ORCPT ); Mon, 12 Oct 2020 09:45:41 -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 360A220678; Mon, 12 Oct 2020 13:44:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1602510264; bh=YCJeFEQUUtkoREajJ56LdPxx2G771ijx7vNc714/OTA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=F/5aYKhsuJoFHeFZMUOzbR/Y48p/O8+pb6Lh5s279NFp5zUr5wcYYLvuyOg3R3rPC kAHd3pGxhje4LEmXL7VshdpnKuOi0NpSk3yYBoPw/5+tK45gdmFVW2wZmwbnikcFrC s0EJYB+G4dhUogigQFJ5iTNHbPCKPS7PO8mbgFiY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dinghao Liu , Andy Shevchenko Subject: [PATCH 5.8 017/124] Platform: OLPC: Fix memleak in olpc_ec_probe Date: Mon, 12 Oct 2020 15:30:21 +0200 Message-Id: <20201012133147.684221628@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201012133146.834528783@linuxfoundation.org> References: <20201012133146.834528783@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: Dinghao Liu commit 4fd9ac6bd3044734a7028bd993944c3617d1eede upstream. When devm_regulator_register() fails, ec should be freed just like when olpc_ec_cmd() fails. Fixes: 231c0c216172a ("Platform: OLPC: Add a regulator for the DCON") Signed-off-by: Dinghao Liu Signed-off-by: Andy Shevchenko Signed-off-by: Greg Kroah-Hartman --- drivers/platform/olpc/olpc-ec.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/drivers/platform/olpc/olpc-ec.c +++ b/drivers/platform/olpc/olpc-ec.c @@ -439,7 +439,9 @@ static int olpc_ec_probe(struct platform &config); if (IS_ERR(ec->dcon_rdev)) { dev_err(&pdev->dev, "failed to register DCON regulator\n"); - return PTR_ERR(ec->dcon_rdev); + err = PTR_ERR(ec->dcon_rdev); + kfree(ec); + return err; } ec->dbgfs_dir = olpc_ec_setup_debugfs();