Re: [PATCH v3] thermal: intel: int3400: clean up ODVP on probe failures

From: Rafael J. Wysocki (Intel)

Date: Wed Jul 22 2026 - 11:09:28 EST


On Tue, Jun 23, 2026 at 3:51 AM Pengpeng Hou <pengpeng@xxxxxxxxxxx> wrote:
>
> evaluate_odvp() creates per-ODVP sysfs files before the thermal zone
> and later probe resources are registered. The current unwind path only
> calls cleanup_odvp() from the late sysfs failure path, so failures after
> evaluate_odvp() but before that label, including
> thermal_tripless_zone_device_register() failures, leave the ODVP files
> and storage behind.
>
> Move the ODVP cleanup to the common ART/TRT unwind path so every failure
> after evaluate_odvp() releases the ODVP state. Also clear the cached
> ODVP pointers in cleanup_odvp(), because evaluate_odvp() can already call
> it for partial setup failures while probe continues.
>
> Fixes: 006f006f1e5c ("thermal/int340x_thermal: Export OEM vendor variables")
> Signed-off-by: Pengpeng Hou <pengpeng@xxxxxxxxxxx>
> ---
> Changes since v2: https://lore.kernel.org/all/20260622153306.79258-1-pengpeng@xxxxxxxxxxx/
> - move cleanup_odvp() to the common free_art_trt unwind path so it also
> covers thermal_tripless_zone_device_register() failures
> - drop the unrelated data_vault cleanup change from v2
> - make cleanup_odvp() idempotent by clearing the cached ODVP pointers
> after freeing them
>
> drivers/thermal/intel/int340x_thermal/int3400_thermal.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/thermal/intel/int340x_thermal/int3400_thermal.c b/drivers/thermal/intel/int340x_thermal/int3400_thermal.c
> index d200734625ee..5d70301d4a3d 100644
> --- a/drivers/thermal/intel/int340x_thermal/int3400_thermal.c
> +++ b/drivers/thermal/intel/int340x_thermal/int3400_thermal.c
> @@ -356,8 +356,10 @@ static void cleanup_odvp(struct int3400_thermal_priv *priv)
> kfree(priv->odvp_attrs[i].attr.attr.name);
> }
> kfree(priv->odvp_attrs);
> + priv->odvp_attrs = NULL;
> }
> kfree(priv->odvp);
> + priv->odvp = NULL;
> priv->odvp_count = 0;
> }
>
> @@ -635,7 +637,6 @@ static int int3400_thermal_probe(struct platform_device *pdev)
> acpi_remove_notify_handler(priv->adev->handle, ACPI_DEVICE_NOTIFY,
> int3400_notify);
> free_sysfs:
> - cleanup_odvp(priv);
> if (!ZERO_OR_NULL_PTR(priv->data_vault)) {
> device_remove_bin_file(&pdev->dev, &bin_attr_data_vault);
> kfree(priv->data_vault);
> @@ -649,6 +650,7 @@ static int int3400_thermal_probe(struct platform_device *pdev)
> acpi_thermal_rel_misc_device_remove(priv->adev->handle);
> thermal_zone_device_unregister(priv->thermal);
> free_art_trt:
> + cleanup_odvp(priv);
> kfree(priv->trts);
> kfree(priv->arts);
> free_priv:
> --

Applied as 7.3 material, thanks!