[PATCH] Revert "thermal/drivers/mediatek: Use devm_of_iomap to avoid resource leak in mtk_thermal_probe"

AngeloGioacchino Del Regno angelogioacchino.delregno at collabora.com
Thu May 25 04:17:10 PDT 2023


Il 25/05/23 13:14, Ricardo Cañuelo ha scritto:
> This reverts commit f05c7b7d9ea9477fcc388476c6f4ade8c66d2d26.
> 
> That change was causing a regression in the generic-adc-thermal-probed
> bootrr test as reported in the kernelci-results list [1].
> A proper rework will take longer, so revert it for now.
> 
> [1] https://groups.io/g/kernelci-results/message/42660
> 
> Signed-off-by: Ricardo Cañuelo <ricardo.canuelo at collabora.com>
> Suggested-by: AngeloGioacchino Del Regno <angelogioacchino.delregno at collabora.com>
> ---

Adding context: the rework would require us to "probably" change this
iomap to getting regmap handle(s) and working with that, which is why
that wouldn't be trivial.

My apologies about initially misunderstanding the fact that
devm_of_iomap() behaves in a different way compared to of_iomap().

Ricardo, huge thanks for sending this revert.

Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno at collabora.com>


>   drivers/thermal/mediatek/auxadc_thermal.c | 14 ++------------
>   1 file changed, 2 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/thermal/mediatek/auxadc_thermal.c b/drivers/thermal/mediatek/auxadc_thermal.c
> index 0b5528804bbd..f59d36de20a0 100644
> --- a/drivers/thermal/mediatek/auxadc_thermal.c
> +++ b/drivers/thermal/mediatek/auxadc_thermal.c
> @@ -1222,12 +1222,7 @@ static int mtk_thermal_probe(struct platform_device *pdev)
>   		return -ENODEV;
>   	}
>   
> -	auxadc_base = devm_of_iomap(&pdev->dev, auxadc, 0, NULL);
> -	if (IS_ERR(auxadc_base)) {
> -		of_node_put(auxadc);
> -		return PTR_ERR(auxadc_base);
> -	}
> -
> +	auxadc_base = of_iomap(auxadc, 0);
>   	auxadc_phys_base = of_get_phys_base(auxadc);
>   
>   	of_node_put(auxadc);
> @@ -1243,12 +1238,7 @@ static int mtk_thermal_probe(struct platform_device *pdev)
>   		return -ENODEV;
>   	}
>   
> -	apmixed_base = devm_of_iomap(&pdev->dev, apmixedsys, 0, NULL);
> -	if (IS_ERR(apmixed_base)) {
> -		of_node_put(apmixedsys);
> -		return PTR_ERR(apmixed_base);
> -	}
> -
> +	apmixed_base = of_iomap(apmixedsys, 0);
>   	apmixed_phys_base = of_get_phys_base(apmixedsys);
>   
>   	of_node_put(apmixedsys);




More information about the Linux-mediatek mailing list