Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Nícolas F. R. A. Prado" <nfraprado@collabora.com>
To: Yan Zhen <yanzhen@vivo.com>
Cc: matthias.bgg@gmail.com, angelogioacchino.delregno@collabora.com,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-mediatek@lists.infradead.org, opensource.kernel@vivo.com
Subject: Re: [PATCH v2] soc: mediatek: Simplify with dev_err_probe()
Date: Fri, 30 Aug 2024 15:32:56 -0400	[thread overview]
Message-ID: <d269df37-3bf9-45fd-8e3f-fb4f36ff9d8f@notapiano> (raw)
In-Reply-To: <20240830080538.376200-1-yanzhen@vivo.com>

Hi,

thank you for the patch. See comments below.

On Fri, Aug 30, 2024 at 04:05:38PM +0800, Yan Zhen wrote:
> Using dev_err_probe() to simplify the error path and unify a 
> message template.
> 

From [1]:

  Describe your changes in imperative mood, e.g. “make xyzzy do frotz” instead of
  “[This patch] makes xyzzy do frotz” or “[I] changed xyzzy to do frotz”, as if
  you are giving orders to the codebase to change its behaviour.

[1] https://www.kernel.org/doc/html/latest/process/submitting-patches.html#describe-your-changes

So should be "Use dev_err_probe()...".

Also, the commit summary seems a bit too broad, please add "mtk-mmsys:" in the
subsystem:

  soc: mediatek: mtk-mmsys: Simplify with dev_err_probe()

> Using this helper is totally fine even if err is known to never
> be -EPROBE_DEFER.
> 
> The benefit compared to a normal dev_err() is the standardized format
> of the error code, it being emitted symbolically and the fact that
> the error code is returned which allows more compact error paths.
> 
> Signed-off-by: Yan Zhen <yanzhen@vivo.com>
> ---
> 
> Changes in v2:
> - Get rid of `ret = PTR_ERR(mmsys->regs);`.
> 
>  drivers/soc/mediatek/mtk-mmsys.c | 15 ++++++---------
>  1 file changed, 6 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/soc/mediatek/mtk-mmsys.c b/drivers/soc/mediatek/mtk-mmsys.c
> index 938240714e54..a6e0c41c10ab 100644
> --- a/drivers/soc/mediatek/mtk-mmsys.c
> +++ b/drivers/soc/mediatek/mtk-mmsys.c
> @@ -397,11 +397,9 @@ static int mtk_mmsys_probe(struct platform_device *pdev)
>  		return -ENOMEM;
>  
>  	mmsys->regs = devm_platform_ioremap_resource(pdev, 0);
> -	if (IS_ERR(mmsys->regs)) {
> -		ret = PTR_ERR(mmsys->regs);
> -		dev_err(dev, "Failed to ioremap mmsys registers: %d\n", ret);
> -		return ret;
> -	}
> +	if (IS_ERR(mmsys->regs))
> +		return dev_err_probe(dev, PTR_ERR(mmsys->regs),
> +					"Failed to ioremap mmsys registers");

You're missing the \n at the end of the string.

Also, would look nicer if it was aligned like so:

		return dev_err_probe(dev, PTR_ERR(mmsys->regs),
				     "Failed to ioremap mmsys registers\n");

>  
>  	mmsys->data = of_device_get_match_data(&pdev->dev);
>  
> @@ -413,10 +411,9 @@ static int mtk_mmsys_probe(struct platform_device *pdev)
>  		mmsys->rcdev.ops = &mtk_mmsys_reset_ops;
>  		mmsys->rcdev.of_node = pdev->dev.of_node;
>  		ret = devm_reset_controller_register(&pdev->dev, &mmsys->rcdev);
> -		if (ret) {
> -			dev_err(&pdev->dev, "Couldn't register mmsys reset controller: %d\n", ret);
> -			return ret;
> -		}
> +		if (ret)
> +			dev_err_probe(&pdev->dev, ret,
> +					"Couldn't register mmsys reset controller");

You're missing the return here. And the \n is also missing.

Also, here checkpatch actually complains about the alignment (run
'scripts/checkpatch.pl --strict' on your patch).

CHECK: Alignment should match open parenthesis
#50: FILE: drivers/soc/mediatek/mtk-mmsys.c:416:
+			dev_err_probe(&pdev->dev, ret,
+					"Couldn't register mmsys reset controller");

After making those changes you can add

Reviewed-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>

Thanks,
Nícolas


      reply	other threads:[~2024-08-30 19:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-30  8:05 [PATCH v2] soc: mediatek: Simplify with dev_err_probe() Yan Zhen
2024-08-30 19:32 ` Nícolas F. R. A. Prado [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=d269df37-3bf9-45fd-8e3f-fb4f36ff9d8f@notapiano \
    --to=nfraprado@collabora.com \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=matthias.bgg@gmail.com \
    --cc=opensource.kernel@vivo.com \
    --cc=yanzhen@vivo.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