[PATCH] pwm: atmel: Make use of dev_err_probe()

Lee Jones lee.jones at linaro.org
Wed Aug 12 05:36:21 EDT 2020


On Wed, 12 Aug 2020, Uwe Kleine-König wrote:

> Hello Alexandre,
> 
> On Wed, Aug 12, 2020 at 10:47:28AM +0200, Alexandre Belloni wrote:
> > On 12/08/2020 10:32:04+0200, Uwe Kleine-König wrote:
> > > On Wed, Aug 12, 2020 at 09:20:02AM +0100, Lee Jones wrote:
> > > > On Wed, 12 Aug 2020, Uwe Kleine-König wrote:
> > > > >  	atmel_pwm->clk = devm_clk_get(&pdev->dev, NULL);
> > > > >  	if (IS_ERR(atmel_pwm->clk))
> > > > > -		return PTR_ERR(atmel_pwm->clk);
> > > > > +		return dev_err_probe(&pdev->dev, PTR_ERR(atmel_pwm->clk),
> > > > > +				     "Failed to get clock\n");
> > > > 
> > > > Isn't dev_err_probe() only useful for drivers handling -EPROBE_DEFER?
> > > 
> > > devm_clk_get() might return -EPROBE_DEFER.
> > 
> > If it did, you wouldn't be able to print this message.
> 
> Why that? It probably won't make it to the console immediately, but once
> the clk is available the log buffer should be pushed out, shouldn't it?
> 
> > I' not sure it is worth adding so many checks for errors that will
> > never happen.
> 
> I'm sure this train of thought is unsustainable. And people will copy
> this code to platforms where this assumption might even be more wrong
> than on at91. 

This driver was authored (and reviewed) with intricate knowledge of
the H/W.  The current code is optimal for this device.  This patch
regresses certain aspects such as binary size and code complexity.

Sorry, but it's a NACK from me, and sounds like one from Alexandre
too.

-- 
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog



More information about the linux-arm-kernel mailing list