[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20220819082235.ygyw3spkbpookzyy@pengutronix.de>
Date: Fri, 19 Aug 2022 10:22:35 +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 v3] pwm: rockchip: Convert to use dev_err_probe()
On Fri, Aug 19, 2022 at 03:07:56PM +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>
> ---
> v3: 1.There is no need to assign it to 'ret', and use PTR_ERR(pc->pclk) directly.
> 2.add the return before dev_err_probe().
> drivers/pwm/pwm-rockchip.c | 14 ++++----------
> 1 file changed, 4 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/pwm/pwm-rockchip.c b/drivers/pwm/pwm-rockchip.c
> index f3647b317152..eda1bd49d260 100644
> --- a/drivers/pwm/pwm-rockchip.c
> +++ b/drivers/pwm/pwm-rockchip.c
> @@ -328,18 +328,12 @@ static int rockchip_pwm_probe(struct platform_device *pdev)
> else
> pc->pclk = pc->clk;
>
> - 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;
> - }
> + if (IS_ERR(pc->pclk))
> + return dev_err_probe(&pdev->dev, PTR_ERR(pc->pclk), "Can't get APB clk\n");
>
> 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)
> + return dev_err_probe(&pdev->dev, ret, "Can't prepare enable PWM clk\n");
>
> ret = clk_prepare_enable(pc->pclk);
> if (ret) {
Still missing two dev_err() that are unconverted ...
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