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: <20220818092618.ek6sg64jgamfl4lm@pengutronix.de>
Date:   Thu, 18 Aug 2022 11:26:18 +0200
From:   Uwe Kleine-König <u.kleine-koenig@...gutronix.de>
To:     zhaoxiao <zhaoxiao@...ontech.com>
Cc:     thierry.reding@...il.com, heiko@...ech.de,
        linux-pwm@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
        linux-rockchip@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] pwm: rockchip: Convert to use dev_err_probe()

Hello,

On Thu, Aug 18, 2022 at 03:55:03PM +0800, zhaoxiao wrote:
> It's fine to call dev_err_probe() in ->probe() when error code is known.
> Convert the driver to use dev_err_probe().
> 
> Signed-off-by: zhaoxiao <zhaoxiao@...ontech.com>

Is zhaoxiao your real name, or is that a nickname/pseudonym? If the
latter please use your real name here. See
Documentation/process/submitting-patches.rst for the justification.

> ---
>  v2: remove the %d in the message.
> 
>  drivers/pwm/pwm-rockchip.c | 10 +++-------
>  1 file changed, 3 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/pwm/pwm-rockchip.c b/drivers/pwm/pwm-rockchip.c
> index f3647b317152..c6e088c1a6bf 100644
> --- a/drivers/pwm/pwm-rockchip.c
> +++ b/drivers/pwm/pwm-rockchip.c
> @@ -330,16 +330,12 @@ static int rockchip_pwm_probe(struct platform_device *pdev)
>  
>  	if (IS_ERR(pc->pclk)) {
>  		ret = PTR_ERR(pc->pclk);
> -		if (ret != -EPROBE_DEFER)
> -			dev_err(&pdev->dev, "Can't get APB clk: %d\n", ret);
> -		return ret;
> +		return dev_err_probe(&pdev->dev, ret, "Can't get APB clk\n");
>  	}

This could be further simplified (as pointed out in the (implicit) v1)
to:

	if (IS_ERR(pc->pclk))
		return dev_err_probe(&pdev->dev, PTR_ERR(pc->pclk), "Can't get APB clk\n");

but I wouldn't insist on that one as it's somewhat subjective if you
like it better on two lines.

>  
>  	ret = clk_prepare_enable(pc->clk);
> -	if (ret) {
> -		dev_err(&pdev->dev, "Can't prepare enable PWM clk: %d\n", ret);
> -		return ret;
> -	}
> +	if (ret)
> +		dev_err_probe(&pdev->dev, ret, "Can't prepare enable PWM clk\n");
>  
>  	ret = clk_prepare_enable(pc->pclk);
>  	if (ret) {

The context here continues with:

 		dev_err(&pdev->dev, "Can't prepare enable APB clk: %d\n", ret);

this could benefit from dev_err_probe(), too.

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |

Download attachment "signature.asc" of type "application/pgp-signature" (489 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ