lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <7b1f01ae.3988f.18769458aaf.Coremail.void0red@hust.edu.cn>
Date:   Mon, 10 Apr 2023 11:46:17 +0800 (GMT+08:00)
From:   陈康 <void0red@...t.edu.cn>
To:     daniel.lezcano@...aro.org
Cc:     amitk@...nel.org, angelogioacchino.delregno@...labora.com,
        bchihi@...libre.com, daniel@...rotopia.org, dzm91@...t.edu.cn,
        error27@...il.com, henry.yen@...iatek.com,
        hust-os-kernel-patches@...glegroups.com,
        linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
        linux-mediatek@...ts.infradead.org, linux-pm@...r.kernel.org,
        matthias.bgg@...il.com, rafael@...nel.org, rdunlap@...radead.org,
        rui.zhang@...el.com, void0red@...il.com
Subject: Re: [PATCH v2 2/2] thermal: mediatek: change clk_prepare_enable to
 devm_clk_get_enabled in mtk_thermal_probe




> -----原始邮件-----
> 发件人: "Kang Chen" <void0red@...t.edu.cn>
> 发送时间: 2023-04-04 00:46:10 (星期二)
> 收件人: daniel.lezcano@...aro.org
> 抄送: amitk@...nel.org, angelogioacchino.delregno@...labora.com, bchihi@...libre.com, daniel@...rotopia.org, dzm91@...t.edu.cn, error27@...il.com, henry.yen@...iatek.com, hust-os-kernel-patches@...glegroups.com, linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org, linux-mediatek@...ts.infradead.org, linux-pm@...r.kernel.org, matthias.bgg@...il.com, rafael@...nel.org, rdunlap@...radead.org, rui.zhang@...el.com, void0red@...il.com, void0red@...t.edu.cn
> 主题: [PATCH v2 2/2] thermal: mediatek: change clk_prepare_enable to devm_clk_get_enabled in mtk_thermal_probe
> 
> use devm_clk_get_enabled to do automatic resource management.
> 
> Signed-off-by: Kang Chen <void0red@...t.edu.cn>
> ---
> I'm not quite sure if this function should return 0 when
> devm_thermal_add_hwmon_sysfs occurs error. So I keep it.
> 
>  drivers/thermal/mediatek/auxadc_thermal.c | 25 ++++++++---------------
>  1 file changed, 8 insertions(+), 17 deletions(-)
> 
> diff --git a/drivers/thermal/mediatek/auxadc_thermal.c b/drivers/thermal/mediatek/auxadc_thermal.c
> index df5e2e354408..5baec2c08ebc 100644
> --- a/drivers/thermal/mediatek/auxadc_thermal.c
> +++ b/drivers/thermal/mediatek/auxadc_thermal.c
> @@ -1178,16 +1178,16 @@ static int mtk_thermal_probe(struct platform_device *pdev)
>  	if (ret)
>  		return ret;
>  
> -	ret = clk_prepare_enable(mt->clk_auxadc);
> -	if (ret) {
> +	ret = devm_clk_get_enabled(&pdev->dev, mt->clk_auxadc);
> +	if (IS_ERR(ret)) {
>  		dev_err(&pdev->dev, "Can't enable auxadc clk: %d\n", ret);
> -		return ret;
> +		return PTR_ERR(ret);
>  	}
>  
> -	ret = clk_prepare_enable(mt->clk_peri_therm);
> -	if (ret) {
> +	ret = devm_clk_get_enabled(&pdev->dev, mt->clk_peri_therm);
> +	if (IS_ERR(ret)) {
>  		dev_err(&pdev->dev, "Can't enable peri clk: %d\n", ret);
> -		goto err_disable_clk_auxadc;
> +		return PTR_ERR(ret);
>  	}
>  
>  	if (mt->conf->version != MTK_THERMAL_V1) {
> @@ -1211,23 +1211,14 @@ static int mtk_thermal_probe(struct platform_device *pdev)
>  
>  	tzdev = devm_thermal_of_zone_register(&pdev->dev, 0, mt,
>  					      &mtk_thermal_ops);
> -	if (IS_ERR(tzdev)) {
> -		ret = PTR_ERR(tzdev);
> -		goto err_disable_clk_peri_therm;
> -	}
> +	if (IS_ERR(tzdev))
> +		return PTR_ERR(tzdev);
>  
>  	ret = devm_thermal_add_hwmon_sysfs(tzdev);
>  	if (ret)
>  		dev_warn(&pdev->dev, "error in thermal_add_hwmon_sysfs");
>  
>  	return 0;
> -
> -err_disable_clk_peri_therm:
> -	clk_disable_unprepare(mt->clk_peri_therm);
> -err_disable_clk_auxadc:
> -	clk_disable_unprepare(mt->clk_auxadc);
> -
> -	return ret;
>  }
>  
>  static int mtk_thermal_remove(struct platform_device *pdev)
> -- 
> 2.34.1

ping?

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ