Re: [PATCH V3 3/7] Drivers: hv: vmbus: add APIs to send/recv hvsock packet and get the r/w-ability

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

 



On Thu, Jul 23, 2015 at 01:24:50PM +0300, Dan Carpenter wrote:
> On Thu, Jul 23, 2015 at 01:10:57PM +0300, Dan Carpenter wrote:
> > In this specific case, writing it as "if (ret != 0)" caused the bug.  If
> > we had written it as "if (ret) return ret;" then there are no zeroes so
> > wouldn't have been any temptation to return the zero instead of the ret.
> 
> I did a search to see if returning the zero instead of the ret was a
> common mistake and it seems like it might be.  I did:
> 
> grep 'if (ret != 0)' drivers/   -r -A1 -n | grep "return 0;" | perl -ne 's/.c-(\d+)-/.c:$1/; print'
> 
> drivers/gpu/drm/nouveau/nouveau_display.c:111                   return 0;
This is also ok, the function is supposed to return ret or-ed with the
relevant flags based on the scan position. It is considered error if 0
is returned (without any flag).

regards
sudip
_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-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