Re: [RFC PATCH 4/5] iio: accel: Support Kionix/ROHM KX022A accelerometer

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 28 Sep 2022 19:23:06 +0300
Matti Vaittinen <mazziesaccount@xxxxxxxxx> wrote:

> Hi Andy,
> 
> On 9/28/22 17:06, Andy Shevchenko wrote:
> > On Wed, Sep 28, 2022 at 02:14:14PM +0300, Matti Vaittinen wrote:  
> >> On 9/22/22 20:03, Jonathan Cameron wrote:  
> >>> On Wed, 21 Sep 2022 14:45:35 +0300  
> > 
> > ...
> >   
> >>>> +		dev_err(dev, "no regmap\n");  
> >>>
> >>> Use dev_err_probe() for all dev_err() stuff in probe paths.
> >>> It ends up cleaner and we don't care about the tiny overhead
> >>> of checking for deferred.  
> >>
> >> This one bothers me a bit. It just does not feel correct to pass -EINVAL for
> >> the dev_err_probe() so the dev_err_probe() can check if -EINVAL !=
> >> -EPROBE_DEFER. I do understand perfectly well the consistent use of
> >> dev_err_probe() for all cases where we get an error-code from a function and
> >> return it - but using dev_err_probe() when we hard-code the return value in
> >> code calling the dev_err_probe() does not feel like "the right thing to do"
> >> (tm).
> >>
> >> Eg, I agree that
> >> return dev_err_probe(dev, ret, "bar");
> >> is nice even if we know the function that gave us the "ret" never requests
> >> defer (as that can change some day).
> >>
> >> However, I don't like issuing:
> >> return dev_err_probe(dev, -EINVAL, "bar");  
> > 
> > This case specifically was added into documentation by 7065f92255bb ("driver
> > core: Clarify that dev_err_probe() is OK even w/out -EPROBE_DEFER").  
> 
> Yes. And this is exactly what I meant with:
>  >> Eg, I agree that
>  >> return dev_err_probe(dev, ret, "bar");
>  >> is nice even if we know the function that gave us the "ret" never   
> requests
>  >> defer  
> 
> There is still (in my opinion) a significant difference if we call:
>  >> return dev_err_probe(dev, -EINVAL, "bar");  
> 
> - where we really hard-code the -EINVAL as a parameter to the 
> dev_err_probe()
> 
> >> Well, please let me know if you think the dev_err_probe() should be used
> >> even in cases where we hard code the return to something...  
> > 
> > And this should be, of course, maintainer's decision.  
> 
> Ultimately, yes.

I'm not that fussed. So happy to accept code taking either view where it
is hard coded in the call like this.
I'd love a dev_err() that took and returned the error value though just
for all those single lines of code saved.

J

> 
> Best Regards
> 	--Matti
> 




[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux