Re: [PATCH] staging:iio: Add wrapper functions around buffer access ops

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

 



On Wed, Dec 14, 2011 at 04:05:12PM +0100, Lars-Peter Clausen wrote:
> On 12/14/2011 03:31 PM, Dan Carpenter wrote:
> > On Wed, Dec 14, 2011 at 11:15:49AM +0100, Lars-Peter Clausen wrote:
> >> Marking the function as __must_check doesn't make much sense here. Since it
> >> will either return an error or the buffer length. So you'll always use the
> >> returned result one way or the other.
> > 
> > Isn't that the point of a __must_check?
> 
> My understanding is that you should use __must_check if it is potentially
> dangerous to ignore the return value. Which is not the case here, if you
> don't look at the return value it's kind of pointless to call the function
> in the first, but it is not dangerous.
> 

I only responded to the previous email because you described exactly
the situation that __must_check is designed for, as a reason to not
use it.  It struck me as humourous.

ERR_PTR() is likewise not dangerous.  It's just a cast, but it
doesn't make sense to not check it, so that's why it has a
__must_check tag.  If a function is part of the infrastructure and
gets called a lot then a __must_check is appropriate.

regards,
dan carpenter

Attachment: signature.asc
Description: Digital signature

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel

[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux