mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
To: "Nícolas F. R. A. Prado" <nfraprado@collabora.com>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	"Viresh Kumar" <viresh.kumar@linaro.org>,
	"Matthias Brugger" <matthias.bgg@gmail.com>
Cc: kernel@collabora.com, linux-pm@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-mediatek@lists.infradead.org
Subject: Re: [PATCH] cpufreq: mediatek: Use dev_err_probe in every error path in probe
Date: Tue, 2 Jul 2024 07:47:55 +0200	[thread overview]
Message-ID: <70b31b71-750b-4de0-9102-0852fef7d623@collabora.com> (raw)
In-Reply-To: <20240628-mtk-cpufreq-dvfs-fail-init-err-v1-1-19c55db23011@collabora.com>

Il 28/06/24 21:48, Nícolas F. R. A. Prado ha scritto:
> Use the dev_err_probe() helper to log the errors on every error path in
> the probe function and its sub-functions. This includes
> * adding error messages where there was none
> * converting over dev_err/dev_warn
> * removing the top-level error message after mtk_cpu_dvfs_info_init() is
>    called, since every error path inside that function already logs the
>    error reason. This gets rid of the misleading error message when probe
>    is deferred:
> 
>      mtk-cpufreq mtk-cpufreq: failed to initialize dvfs info for cpu0
> 
> Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
> ---
>   drivers/cpufreq/mediatek-cpufreq.c | 66 ++++++++++++++++++--------------------
>   1 file changed, 31 insertions(+), 35 deletions(-)
> 
> diff --git a/drivers/cpufreq/mediatek-cpufreq.c b/drivers/cpufreq/mediatek-cpufreq.c
> index 518606adf14e..b21425bb83be 100644
> --- a/drivers/cpufreq/mediatek-cpufreq.c
> +++ b/drivers/cpufreq/mediatek-cpufreq.c

..snip..

> @@ -487,7 +488,7 @@ static int mtk_cpu_dvfs_info_init(struct mtk_cpu_dvfs_info *info, int cpu)
>   	rate = clk_get_rate(info->inter_clk);
>   	opp = dev_pm_opp_find_freq_ceil(cpu_dev, &rate);
>   	if (IS_ERR(opp)) {
> -		dev_err(cpu_dev, "cpu%d: failed to get intermediate opp\n", cpu);
> +		dev_err_probe(cpu_dev, ret, "cpu%d: failed to get intermediate opp\n", cpu);
>   		ret = PTR_ERR(opp);

I believe you want to first assign ret, and then use it in dev_err_probe() :-P

Please fix. After which:

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

Cheers!

>   		goto out_disable_inter_clock;
>   	}
> @@ -501,7 +502,7 @@ static int mtk_cpu_dvfs_info_init(struct mtk_cpu_dvfs_info *info, int cpu)
>   	info->opp_nb.notifier_call = mtk_cpufreq_opp_notifier;
>   	ret = dev_pm_opp_register_notifier(cpu_dev, &info->opp_nb);
>   	if (ret) {
> -		dev_err(cpu_dev, "cpu%d: failed to register opp notifier\n", cpu);
> +		dev_err_probe(cpu_dev, ret, "cpu%d: failed to register opp notifier\n", cpu);
>   		goto out_disable_inter_clock;
>   	}
>   
> @@ -629,11 +630,9 @@ static int mtk_cpufreq_probe(struct platform_device *pdev)
>   	int cpu, ret;
>   
>   	data = dev_get_platdata(&pdev->dev);
> -	if (!data) {
> -		dev_err(&pdev->dev,
> -			"failed to get mtk cpufreq platform data\n");
> -		return -ENODEV;
> -	}
> +	if (!data)
> +		return dev_err_probe(&pdev->dev, -ENODEV,
> +				     "failed to get mtk cpufreq platform data\n");
>   
>   	for_each_possible_cpu(cpu) {
>   		info = mtk_cpu_dvfs_info_lookup(cpu);
> @@ -643,24 +642,21 @@ static int mtk_cpufreq_probe(struct platform_device *pdev)
>   		info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL);
>   		if (!info) {
>   			ret = -ENOMEM;
> +			dev_err_probe(&pdev->dev, ret, "Failed to allocate dvfs_info\n");
>   			goto release_dvfs_info_list;
>   		}
>   
>   		info->soc_data = data;
>   		ret = mtk_cpu_dvfs_info_init(info, cpu);
> -		if (ret) {
> -			dev_err(&pdev->dev,
> -				"failed to initialize dvfs info for cpu%d\n",
> -				cpu);
> +		if (ret)
>   			goto release_dvfs_info_list;
> -		}
>   
>   		list_add(&info->list_head, &dvfs_info_list);
>   	}
>   
>   	ret = cpufreq_register_driver(&mtk_cpufreq_driver);
>   	if (ret) {
> -		dev_err(&pdev->dev, "failed to register mtk cpufreq driver\n");
> +		dev_err_probe(&pdev->dev, ret, "failed to register mtk cpufreq driver\n");
>   		goto release_dvfs_info_list;
>   	}
>   
> 
> ---
> base-commit: 0fc4bfab2cd45f9acb86c4f04b5191e114e901ed
> change-id: 20240627-mtk-cpufreq-dvfs-fail-init-err-0a662ca72de2
> 
> Best regards,



  reply	other threads:[~2024-07-02  5:47 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-28 19:48 Nícolas F. R. A. Prado
2024-07-02  5:47 ` AngeloGioacchino Del Regno [this message]
2024-07-02  5:57 ` Viresh Kumar
2024-07-02  8:26   ` AngeloGioacchino Del Regno
2024-07-02  8:43     ` Viresh Kumar
2024-07-03 12:43       ` AngeloGioacchino Del Regno
2024-07-04  3:09         ` Viresh Kumar
2024-07-05 15:13       ` Nícolas F. R. A. Prado
2024-07-08  6:42         ` Viresh Kumar

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=70b31b71-750b-4de0-9102-0852fef7d623@collabora.com \
    --to=angelogioacchino.delregno@collabora.com \
    --cc=kernel@collabora.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=matthias.bgg@gmail.com \
    --cc=nfraprado@collabora.com \
    --cc=rafael@kernel.org \
    --cc=viresh.kumar@linaro.org \
    /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®