[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <mhng-452a4fec-be33-4b49-a904-edb4b4c81e0c@palmerdabbelt-glaptop1>
Date: Wed, 26 Aug 2020 09:22:24 -0700 (PDT)
From: Palmer Dabbelt <palmer@...belt.com>
To: krzk@...nel.org
CC: thierry.reding@...il.com, u.kleine-koenig@...gutronix.de,
lee.jones@...aro.org, nsaenzjulienne@...e.de, f.fainelli@...il.com,
rjui@...adcom.com, sbranden@...adcom.com,
bcm-kernel-feedback-list@...adcom.com, paul@...pouillou.net,
heiko@...ech.de, Paul Walmsley <paul.walmsley@...ive.com>,
orsonzhai@...il.com, baolin.wang7@...il.com, zhang.lyra@...il.com,
mripard@...nel.org, wens@...e.org, linux-pwm@...r.kernel.org,
linux-rpi-kernel@...ts.infradead.org,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
linux-rockchip@...ts.infradead.org,
linux-riscv@...ts.infradead.org, krzk@...nel.org
Subject: Re: [PATCH 4/6] pwm: sifive: Simplify with dev_err_probe()
On Wed, 26 Aug 2020 07:47:45 PDT (-0700), krzk@...nel.org wrote:
> Common pattern of handling deferred probe can be simplified with
> dev_err_probe(). Less code and also it prints the error value.
>
> Signed-off-by: Krzysztof Kozlowski <krzk@...nel.org>
> ---
> drivers/pwm/pwm-sifive.c | 8 +++-----
> 1 file changed, 3 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/pwm/pwm-sifive.c b/drivers/pwm/pwm-sifive.c
> index 62de0bb85921..2485fbaaead2 100644
> --- a/drivers/pwm/pwm-sifive.c
> +++ b/drivers/pwm/pwm-sifive.c
> @@ -254,11 +254,9 @@ static int pwm_sifive_probe(struct platform_device *pdev)
> return PTR_ERR(ddata->regs);
>
> ddata->clk = devm_clk_get(dev, NULL);
> - if (IS_ERR(ddata->clk)) {
> - if (PTR_ERR(ddata->clk) != -EPROBE_DEFER)
> - dev_err(dev, "Unable to find controller clock\n");
> - return PTR_ERR(ddata->clk);
> - }
> + if (IS_ERR(ddata->clk))
> + return dev_err_probe(dev, PTR_ERR(ddata->clk),
> + "Unable to find controller clock\n");
>
> ret = clk_prepare_enable(ddata->clk);
> if (ret) {
Acked-by: Palmer Dabbelt <palmerdabbelt@...gle.com>
Powered by blists - more mailing lists