From patchwork Mon Oct 12 13:26:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 270346 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=-9.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, 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 A0496C43457 for ; Mon, 12 Oct 2020 13:42:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5204F208B8 for ; Mon, 12 Oct 2020 13:42:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1602510125; bh=YCJeFEQUUtkoREajJ56LdPxx2G771ijx7vNc714/OTA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=LHQhmYt71lrHletU4K9RWbA6VBe/tMSTINpzVS8BMtFbbWT6EZSqAsO/Uwhsi6SRg GaIPrD9e5Qt4kJsTuouDU8JnIX+1Xe0aonZZmv+Uu1tw8d/yGeSsmY7La+eEEjtvOO lT5CIfav2tiZ/yhK+Mnho8HuN38dOFTPeN6S8D5Y= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731515AbgJLNmE (ORCPT ); Mon, 12 Oct 2020 09:42:04 -0400 Received: from mail.kernel.org ([198.145.29.99]:46202 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731504AbgJLNmD (ORCPT ); Mon, 12 Oct 2020 09:42:03 -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 7A1ED2087E; Mon, 12 Oct 2020 13:41:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1602510111; bh=YCJeFEQUUtkoREajJ56LdPxx2G771ijx7vNc714/OTA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jwD7sLthimxcN/8fVRRWAxp5PbNcrvfmjQ8m65JarE3MvBoRkaY6bzk3yTwrpISY9 xiD88wQS0cJwkQNbVqIIwUO5uznal4xDo7+7rFbb4eQpId6EVFlC9l4vhRO9TT5eOy wZZ0eIITSENNh8G+8SvJij+W2dmd3Itv9poUyORM= 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.4 14/85] Platform: OLPC: Fix memleak in olpc_ec_probe Date: Mon, 12 Oct 2020 15:26:37 +0200 Message-Id: <20201012132633.557770036@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201012132632.846779148@linuxfoundation.org> References: <20201012132632.846779148@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@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();