From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8C517C001E0 for ; Mon, 23 Oct 2023 11:33:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233787AbjJWLdZ (ORCPT ); Mon, 23 Oct 2023 07:33:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48252 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234126AbjJWLdW (ORCPT ); Mon, 23 Oct 2023 07:33:22 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EC098100 for ; Mon, 23 Oct 2023 04:33:18 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3DED2C433C9; Mon, 23 Oct 2023 11:33:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1698060798; bh=cRZDVFB3/fiU9elFx8D/JF2XFZxVDMcYY2kXcudBhKY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OEpJan673h3W5Q/VZESfeGwUX5Yex6VwJHsBi1VaN6vAkaNmXDvjZnCf6LtX4zWQ4 je75tzAA2GnpM7V+4nD+Kvz3vVfpRpguPR3sbbk++9/+xxZC6VOnwln0E7LaP0TYBQ Og4DSbXdJW/RntbwyqknPbTWOFdHEeDMr1b6dfe0= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, =?UTF-8?q?Micha=C5=82=20Miros=C5=82aw?= , Mark Brown , Sasha Levin Subject: [PATCH 5.4 096/123] regulator/core: Revert "fix kobject release warning and memory leak in regulator_register()" Date: Mon, 23 Oct 2023 12:57:34 +0200 Message-ID: <20231023104820.910665366@linuxfoundation.org> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231023104817.691299567@linuxfoundation.org> References: <20231023104817.691299567@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org 5.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Michał Mirosław [ Upstream commit 6e800968f6a715c0661716d2ec5e1f56ed9f9c08 ] This reverts commit 5f4b204b6b8153923d5be8002c5f7082985d153f. Since rdev->dev now has a release() callback, the proper way of freeing the initialized device can be restored. Signed-off-by: Michał Mirosław Link: https://lore.kernel.org/r/d7f469f3f7b1f0e1d52f9a7ede3f3c5703382090.1695077303.git.mirq-linux@rere.qmqm.pl Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- drivers/regulator/core.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index fe4b666edd037..87d0cd6f49ca9 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -5351,15 +5351,11 @@ regulator_register(const struct regulator_desc *regulator_desc, mutex_lock(®ulator_list_mutex); regulator_ena_gpio_free(rdev); mutex_unlock(®ulator_list_mutex); - put_device(&rdev->dev); - rdev = NULL; clean: if (dangling_of_gpiod) gpiod_put(config->ena_gpiod); - if (rdev && rdev->dev.of_node) - of_node_put(rdev->dev.of_node); - kfree(rdev); kfree(config); + put_device(&rdev->dev); rinse: if (dangling_cfg_gpiod) gpiod_put(cfg->ena_gpiod); -- 2.40.1