[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200924141659.4wov7w2l2bllpre4@pengutronix.de>
Date: Thu, 24 Sep 2020 16:16:59 +0200
From: Uwe Kleine-König <u.kleine-koenig@...gutronix.de>
To: Andy Shevchenko <andriy.shevchenko@...el.com>
Cc: Rahul Tanwar <rahul.tanwar@...ux.intel.com>,
linux-pwm@...r.kernel.org, lee.jones@...aro.org,
thierry.reding@...il.com, p.zabel@...gutronix.de,
robh+dt@...nel.org, linux-kernel@...r.kernel.org,
devicetree@...r.kernel.org, songjun.Wu@...el.com,
cheol.yong.kim@...el.com, qi-ming.wu@...el.com,
rahul.tanwar.linux@...il.com, rtanwar@...linear.com
Subject: Re: [PATCH v13 2/2] Add PWM fan controller driver for LGM SoC
On Thu, Sep 24, 2020 at 04:23:34PM +0300, Andy Shevchenko wrote:
> On Thu, Sep 24, 2020 at 08:55:34AM +0200, Uwe Kleine-König wrote:
> > On Tue, Sep 15, 2020 at 04:23:37PM +0800, Rahul Tanwar wrote:
>
> ...
>
> > > + ret = lgm_clk_enable(dev, pc);
> > > + if (ret) {
> > > + dev_err(dev, "failed to enable clock\n");
> >
> > You used dev_err_probe four times for six error paths. I wonder why you
> > didn't use it here (and below for a failing pwmchip_add()).
>
> dev_err_probe() makes sense when we might experience deferred probe. In neither
> of mentioned function this can be the case.
>
> > > + return ret;
> > > + }
>
> ...
>
> > > + ret = lgm_reset_control_deassert(dev, pc);
> > > + if (ret)
> > > + return dev_err_probe(dev, ret, "cannot deassert reset control\n");
> >
> > After lgm_reset_control_deassert is called pc->rst is unused. So there
> > is no need to have this member in struct lgm_pwm_chip. The same applies
> > to ->clk. (You have to pass rst (or clk) to devm_add_action_or_reset for
> > that to work. Looks like a nice idea anyhow.)
>
> True. And above dev_err_probe() is not needed.
You argue that dev_err_probe() gives no benefit as
lgm_reset_control_deassert won't return -EPROBE_DEFER, right?
Still I consider it a useful function because
a) I (as an author or as a reviewer) don't need to think if the
failing function might return -EPROBE_DEFER now or in the future.
dev_err_probe does the right thing even for functions that don't
return -EPROBE_DEFER.
b) With dev_err_probe() I can accomplish things in a single line that
need two lines when open coding it.
c) dev_err_probe() emits the symbolic error name without having to
resort to %pe + ERR_PTR.
d) Using dev_err_probe() for all error paths gives a consistency that I
like with a maintainer's hat on.
So I still want to request using dev_err_probe() in all error paths.
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