Message ID | 20200826144747.9436-4-krzk@kernel.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [1/6] pwm: bcm2835: Simplify with dev_err_probe() | expand |
On Wed, 26 Aug 2020 07:47:45 PDT (-0700), krzk@kernel.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@kernel.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@google.com>
On Wed, Aug 26, 2020 at 04:47:45PM +0200, Krzysztof Kozlowski 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@kernel.org> Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Thanks Uwe
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) {
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@kernel.org> --- drivers/pwm/pwm-sifive.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)