mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Daniel Lezcano <daniel.lezcano@linaro.org>
To: rafael@kernel.org
Cc: rui.zhang@intel.com, linux-pm@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	"Florian Fainelli" <f.fainelli@gmail.com>,
	"Ray Jui" <rjui@broadcom.com>,
	"Scott Branden" <sbranden@broadcom.com>,
	"Amit Kucheria" <amitk@kernel.org>,
	"Broadcom internal kernel review list"
	<bcm-kernel-feedback-list@broadcom.com>,
	"Niklas Söderlund" <niklas.soderlund+renesas@ragnatech.se>,
	"Kunihiko Hayashi" <hayashi.kunihiko@socionext.com>,
	"ye xingchen" <ye.xingchen@zte.com.cn>,
	"moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE"
	<linux-rpi-kernel@lists.infradead.org>,
	"moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE"
	<linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH v2 1/3] thermal/drivers/bcm2835: Remove buggy call to thermal_of_zone_unregister
Date: Fri, 7 Apr 2023 18:35:35 +0200	[thread overview]
Message-ID: <67315726-de8a-bc58-e4fd-d312899d6362@linaro.org> (raw)
In-Reply-To: <20230404075138.2914680-1-daniel.lezcano@linaro.org>


Hi,

it seems like the remaining patches of the previous series does not 
raise feedbacks, I assume they are fine.

If nobody raises concern about it after this week-end, they will be 
applied to candidate for linux-next

Thanks
   -- Daniel


On 04/04/2023 09:51, Daniel Lezcano wrote:
> The driver is using the devm_thermal_of_zone_device_register().
> 
> In the error path of the function calling
> devm_thermal_of_zone_device_register(), the function
> devm_thermal_of_zone_unregister() should be called instead of
> thermal_of_zone_unregister(), otherwise this one will be called twice
> when the device is freed.
> 
> The same happens for the remove function where the devm_ guarantee the
> thermal_of_zone_unregister() will be called, so adding this call in
> the remove function will lead to a double free also.
> 
> Use devm_ variant in the error path of the probe function.
> 
> Remove thermal_of_zone_unregister() in the remove function.
> 
> Cc: Florian Fainelli <f.fainelli@gmail.com>
> Cc: Ray Jui <rjui@broadcom.com>
> Cc: Scott Branden <sbranden@broadcom.com>
> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
> ---
>     V2:
>       - Fixed wrong label call on the error path
> ---
>   drivers/thermal/broadcom/bcm2835_thermal.c | 4 +---
>   1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/thermal/broadcom/bcm2835_thermal.c b/drivers/thermal/broadcom/bcm2835_thermal.c
> index a217d832f24e..3acc9288b310 100644
> --- a/drivers/thermal/broadcom/bcm2835_thermal.c
> +++ b/drivers/thermal/broadcom/bcm2835_thermal.c
> @@ -275,7 +275,7 @@ static int bcm2835_thermal_probe(struct platform_device *pdev)
>   
>   	return 0;
>   err_tz:
> -	thermal_of_zone_unregister(tz);
> +	devm_thermal_of_zone_unregister(&pdev->dev, tz);
>   err_clk:
>   	clk_disable_unprepare(data->clk);
>   
> @@ -285,10 +285,8 @@ static int bcm2835_thermal_probe(struct platform_device *pdev)
>   static int bcm2835_thermal_remove(struct platform_device *pdev)
>   {
>   	struct bcm2835_thermal_data *data = platform_get_drvdata(pdev);
> -	struct thermal_zone_device *tz = data->tz;
>   
>   	debugfs_remove_recursive(data->debugfsdir);
> -	thermal_of_zone_unregister(tz);
>   	clk_disable_unprepare(data->clk);
>   
>   	return 0;

-- 
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog


      parent reply	other threads:[~2023-04-07 16:35 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-04  7:51 Daniel Lezcano
2023-04-04  7:51 ` [PATCH v2 2/3] thermal/of: Unexport unused OF functions Daniel Lezcano
2023-04-04  7:51 ` [PATCH v2 3/3] thermal/core: Alloc-copy-free the thermal zone parameters structure Daniel Lezcano
2023-04-07 16:35 ` Daniel Lezcano [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=67315726-de8a-bc58-e4fd-d312899d6362@linaro.org \
    --to=daniel.lezcano@linaro.org \
    --cc=amitk@kernel.org \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=f.fainelli@gmail.com \
    --cc=hayashi.kunihiko@socionext.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-rpi-kernel@lists.infradead.org \
    --cc=niklas.soderlund+renesas@ragnatech.se \
    --cc=rafael@kernel.org \
    --cc=rjui@broadcom.com \
    --cc=rui.zhang@intel.com \
    --cc=sbranden@broadcom.com \
    --cc=ye.xingchen@zte.com.cn \
    /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

all inboxes | Powered by JetHome®