devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
To: Li-hao Kuo <lhjeff911@gmail.com>,
	rafael@kernel.org, daniel.lezcano@linaro.org, amitk@kernel.org,
	rui.zhang@intel.com, robh+dt@kernel.org,
	linux-pm@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org
Cc: lh.kuo@sunplus.com
Subject: Re: [PATCH v10 1/2] thermal: Add thermal driver for Sunplus
Date: Wed, 13 Jul 2022 09:52:32 +0200	[thread overview]
Message-ID: <be752ee1-3732-bcbd-4d31-6d6fe0bd251f@linaro.org> (raw)
In-Reply-To: <b114b6f8ea51054561a61dc4982715bb73633ec5.1654660009.git.lhjeff911@gmail.com>

On 12/07/2022 09:30, Li-hao Kuo wrote:
> Add thermal driver for Sunplus.
> 
> Signed-off-by: Li-hao Kuo <lhjeff911@gmail.com>

Thank you for your patch. There is something to discuss/improve.

_data);
> +	ret = sunplus_get_otp_temp_coef(sp_data, &pdev->dev);
> +	if (ret)
> +		return ret;
> +
> +	sp_data->pcb_tz = devm_thermal_zone_of_sensor_register(&pdev->dev,
> +							    0,
> +							    sp_data, &sp_of_thermal_ops);
> +
> +	if (IS_ERR(sp_data->pcb_tz)) {
> +		ret = PTR_ERR(sp_data->pcb_tz);
> +		dev_err(dev, "Failed to register tsensor: %d\n", ret);
> +		return ret;
> +	}
> +
> +	return ret;
> +}
> +
> +static int sunplus_thermal_remove(struct platform_device *pdev)
> +{
> +	struct sp_thermal_data *sp_data = platform_get_drvdata(pdev);
> +
> +	thermal_zone_of_sensor_unregister(&pdev->dev, sp_data->pcb_tz);

You used devm to register, so this looks wrong and will lead to double free.


Best regards,
Krzysztof

  reply	other threads:[~2022-07-13  7:52 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-12  7:30 [PATCH v10 0/2] Add thermal control driver for Sunplus SoC Li-hao Kuo
2022-07-12  7:30 ` [PATCH v10 1/2] thermal: Add thermal driver for Sunplus Li-hao Kuo
2022-07-13  7:52   ` Krzysztof Kozlowski [this message]
2022-07-14  5:32     ` Lh Kuo 郭力豪
2022-07-14  6:50       ` Krzysztof Kozlowski
2022-07-21  3:04   ` kernel test robot
2022-07-21  6:32   ` Krzysztof Kozlowski
2022-07-12  7:30 ` [PATCH v10 2/2] dt-bindings: thermal: Add Sunplus schema Li-hao Kuo
2022-07-13  7:50   ` Krzysztof Kozlowski

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=be752ee1-3732-bcbd-4d31-6d6fe0bd251f@linaro.org \
    --to=krzysztof.kozlowski@linaro.org \
    --cc=amitk@kernel.org \
    --cc=daniel.lezcano@linaro.org \
    --cc=devicetree@vger.kernel.org \
    --cc=lh.kuo@sunplus.com \
    --cc=lhjeff911@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rafael@kernel.org \
    --cc=robh+dt@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;
as well as URLs for NNTP newsgroup(s).