From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E14E915ACB for ; Mon, 23 Oct 2023 11:25:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="UWMaz+7B" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3196DC433C9; Mon, 23 Oct 2023 11:25:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1698060344; bh=Vc/L8Vz8//K3JhJXCgPBbFq1ygQvgzQxHPinIoc3lqY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UWMaz+7BRI9iNpCVeXZBRo1mW9P6G/TMOZu0gwNgRva6Nvntaa98Imf+pxExuYpRf beCE41hL9rcSkvTiuhoo1ZV/w0efLm6HYR7y8hvyGWHwMV7LXX4S63r40UxchGA6vd 6Odi6+97yX6cu8an1JTqZ63mr9lzT5oLF+qyOEYs= 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 6.1 114/196] regulator/core: Revert "fix kobject release warning and memory leak in regulator_register()" Date: Mon, 23 Oct 2023 12:56:19 +0200 Message-ID: <20231023104831.742454727@linuxfoundation.org> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231023104828.488041585@linuxfoundation.org> References: <20231023104828.488041585@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 6.1-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 f6a95f72af18d..34d3d82819064 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -5725,15 +5725,11 @@ regulator_register(struct device *dev, 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