From: srinivas pandruvada <srinivas.pandruvada@linux.intel.com>
To: Pengpeng Hou <pengpeng@iscas.ac.cn>,
"Rafael J . Wysocki" <rafael@kernel.org>,
Daniel Lezcano <daniel.lezcano@kernel.org>,
Zhang Rui <rui.zhang@intel.com>,
Lukasz Luba <lukasz.luba@arm.com>
Cc: Kaushlendra Kumar <kaushlendra.kumar@intel.com>,
Kees Cook <kees@kernel.org>,
Miquel Raynal <miquel.raynal@bootlin.com>,
Christophe JAILLET <christophe.jaillet@wanadoo.fr>,
kernel test robot <lkp@intel.com>,
linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] thermal: intel: int3400: clean up ODVP files on probe failures
Date: Mon, 22 Jun 2026 13:30:13 -0700 [thread overview]
Message-ID: <7ff5b6742c28da965eaf0a1175cf031d8786c1aa.camel@linux.intel.com> (raw)
In-Reply-To: <20260622153306.79258-1-pengpeng@iscas.ac.cn>
Hi Hou,
On Mon, 2026-06-22 at 23:33 +0800, Pengpeng Hou wrote:
> int3400_thermal_probe() creates ODVP sysfs files before several later
> probe steps can still fail. The late error paths unregister the
> thermal
> zone and remove other sysfs groups, but they do not remove the ODVP
> files
> or free the ODVP attribute storage.
OK, you added a cleanup_odvp() after thermal_zone_device_unregister().
But it will not cover thermal_tripless_zone_device_register() failure.
You could have moved cleanup_odvp() instead of copy before free_priv:
You are also adding free for data_vault. There is no description of
that. I suggest to add another change for that. Also that needs to be
done for other error case also for example when free_imok.
Thanks,
Srinivas
>
> Run the ODVP cleanup from the existing post-ODVP error path, and
> clear
> the saved ODVP pointers after freeing them so the cleanup remains
> safe
> when reached after the later sysfs cleanup path has already removed
> the
> files.
>
> Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn>
> Reported-by: kernel test robot <lkp@intel.com>
> Closes:
> https://lore.kernel.org/oe-kbuild-all/202606152042.8kTVDHYg-lkp@intel.com/
> ---
> Changes since v1:
> - Avoid adding new error labels; reuse the existing free_art_trt path
> so
> W=1 builds do not report unused labels.
> - Clear ODVP and data_vault pointers after freeing them.
> - Free data_vault directly when bin-file creation fails.
>
> drivers/thermal/intel/int340x_thermal/int3400_thermal.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/drivers/thermal/intel/int340x_thermal/int3400_thermal.c
> b/drivers/thermal/intel/int340x_thermal/int3400_thermal.c
> index 66db4b1effb4..5b59634bcc2e 100644
> --- a/drivers/thermal/intel/int340x_thermal/int3400_thermal.c
> +++ b/drivers/thermal/intel/int340x_thermal/int3400_thermal.c
> @@ -357,7 +357,9 @@ static void cleanup_odvp(struct
> int3400_thermal_priv *priv)
> }
> kfree(priv->odvp_attrs);
> + priv->odvp_attrs = NULL;
> }
> kfree(priv->odvp);
> + priv->odvp = NULL;
> priv->odvp_count = 0;
> }
>
> @@ -620,6 +622,9 @@ static int int3400_thermal_probe(struct
> platform_device *pdev)
> if (!ZERO_OR_NULL_PTR(priv->data_vault)) {
> result = device_create_bin_file(&pdev->dev,
> &bin_attr_data_vault);
> - if (result)
> + if (result) {
> + kfree(priv->data_vault);
> + priv->data_vault = NULL;
> goto free_uuid;
> + }
> }
>
> @@ -651,8 +656,9 @@ static int int3400_thermal_probe(struct
> platform_device *pdev)
> 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);
> + priv->data_vault = NULL;
> }
> free_uuid:
> sysfs_remove_group(&pdev->dev.kobj, &uuid_attribute_group);
> @@ -667,6 +674,7 @@ static int int3400_thermal_probe(struct
> platform_device *pdev)
> if (!priv->rel_misc_dev_res)
> acpi_thermal_rel_misc_device_remove(priv->adev-
> >handle);
> thermal_zone_device_unregister(priv->thermal);
> + cleanup_odvp(priv);
> free_art_trt:
> kfree(priv->trts);
> kfree(priv->arts);
prev parent reply other threads:[~2026-06-22 20:30 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-22 15:33 [PATCH v2] thermal: intel: int3400: clean up ODVP files on probe failures Pengpeng Hou
2026-06-22 20:30 ` srinivas pandruvada [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7ff5b6742c28da965eaf0a1175cf031d8786c1aa.camel@linux.intel.com \
--to=srinivas.pandruvada@linux.intel.com \
--cc=christophe.jaillet@wanadoo.fr \
--cc=daniel.lezcano@kernel.org \
--cc=kaushlendra.kumar@intel.com \
--cc=kees@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=lkp@intel.com \
--cc=lukasz.luba@arm.com \
--cc=miquel.raynal@bootlin.com \
--cc=pengpeng@iscas.ac.cn \
--cc=rafael@kernel.org \
--cc=rui.zhang@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox