From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 A2AD04EF137; Thu, 17 Sep 2026 17:53:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789667606; cv=none; b=Ex05ma1WfYwGEd8Z9zOUsbiSmLy5amiXcT83PL/8g/W2KjTmBpFmmhambXSwB3Tpfx+EnY2forgxpqS6d8E7XEi95n9bbq/TPRkbn3TctB3ZdnkfKG8tKz9toc3CH696jmouLfW/SbSdG3wC0tlsHTBkOoqH9/bugFnKIfRE4kk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789667606; c=relaxed/simple; bh=2snxsHW09H/ZoaDfPDQHDLv9iTqDvIwKb0UIWlUf0FY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=cCMlo7QXIDp8VZ54Kkwh1fPK9wmP12kedkjcTz1+Bwe5YCx0DF0siiInIkw2HJP2bWbpfbSo72fgtEgnZOfjGrmx7jilN7NkvZos0t2WdM9Gigq0nNSWBiq/HHHhBZEXqEP4rOZmETkZCjG1NI8o+ZJ0Tu0rRwHAaLzRW44O36M= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=rtZYySRC; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="rtZYySRC" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D075B1F000FF; Thu, 17 Sep 2026 17:53:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1789667604; bh=dlaD71TrNK+7QjtC1xX6Jg2MEG97+TfPPyFy/SsZP0M=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=rtZYySRCh3R8YwP1WKLQtzGt0KoZFu0OogpMhH4yO7K+mwWBrgWqgaG7ppmNfd7rN dVgOVCX2StVjXDMyHdFxKoEEW8g+upp4ngWPEAitvfXTyMV2NlYfrhPZ2Z6bCKTe1g lW4WQkNWwP5CZ2P9SqzOq995e+gUQ++sjSxctfvQ= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Daniel Lezcano , Daniel Lezcano , Lukasz Luba , Sasha Levin Subject: [PATCH 6.12 0148/1102] thermal/drivers/tegra/soctherma: Switch to devm cooling device registration Date: Thu, 17 Sep 2026 16:01:31 +0100 Message-ID: <20260917151543.243638989@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260917151539.408551884@linuxfoundation.org> References: <20260917151539.408551884@linuxfoundation.org> User-Agent: quilt/0.69 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-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Daniel Lezcano [ Upstream commit ee126267bc04bfb03816ae9d71ca24c5bf99e739 ] Use devm_thermal_of_cooling_device_register() to simplify resource management and avoid manual cleanup in error paths. As a side effect this change has the benefit of solving an existing issue. Before, the function tegra_soctherm_remove() only called debugfs_remove_recursive() and never called thermal_cooling_device_unregister() for any of the cooling devices registered here. After the driver removal, the thermal framework's cdev list would still hold references to thermal_cooling_device objects whose devdata pointer (ts) pointed to memory already freed by the platform device's devm cleanup. With this change, the cooling device is unregistered when the driver is removed, thus fixing the issue above. Signed-off-by: Daniel Lezcano Signed-off-by: Daniel Lezcano Reviewed-by: Lukasz Luba Link: https://patch.msgid.link/20260424160019.41710-2-daniel.lezcano@oss.qualcomm.com Signed-off-by: Sasha Levin --- drivers/thermal/tegra/soctherm.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/thermal/tegra/soctherm.c b/drivers/thermal/tegra/soctherm.c index a023c948afbdd..5a163c0befa64 100644 --- a/drivers/thermal/tegra/soctherm.c +++ b/drivers/thermal/tegra/soctherm.c @@ -1696,9 +1696,9 @@ static void soctherm_init_hw_throt_cdev(struct platform_device *pdev) stc->init = true; } else { - tcd = thermal_of_cooling_device_register(np_stcc, - (char *)name, ts, - &throt_cooling_ops); + tcd = devm_thermal_of_cooling_device_register(dev, np_stcc, + (char *)name, ts, + &throt_cooling_ops); if (IS_ERR_OR_NULL(tcd)) { dev_err(dev, "throttle-cfg: %s: failed to register cooling device\n", -- 2.53.0