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

2015-07-24 Thread Dan Carpenter
On Fri, Jul 24, 2015 at 11:57:01AM +0530, Sudip Mukherjee wrote: > 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). Yeah. You're right. I looked through my list again

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

2015-07-23 Thread Sudip Mukherjee
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

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

2015-07-23 Thread Dexuan Cui
> From: Dan Carpenter > Sent: Thursday, July 23, 2015 18:25 > 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 bee

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

2015-07-23 Thread Dan Carpenter
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 sea

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

2015-07-23 Thread Dan Carpenter
On Thu, Jul 23, 2015 at 03:05:16AM +, Dexuan Cui wrote: > The kind of usage is not rare in the kernel code: Yeah. But it's used 5% of the time. If it's under 15% then there is a risk that we'll write a checkpatch rule to enforce the standard way... There are some places where != 0 is idiomat

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

2015-07-22 Thread Dexuan Cui
> From: Dan Carpenter > Sent: Wednesday, July 22, 2015 18:36 > To: Dexuan Cui > On Wed, Jul 22, 2015 at 10:09:10AM +, Dexuan Cui wrote: > > > I'd suggest you do something like > > > > > > if (ret == -EAGIAIN) > > > return 0; > > > else if (ret) > > > return ret; > > > >

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

2015-07-22 Thread Dan Carpenter
On Wed, Jul 22, 2015 at 10:09:10AM +, Dexuan Cui wrote: > > I'd suggest you do something like > > > > if (ret == -EAGIAIN) > > return 0; > > else if (ret) > > return ret; > > > > to make it future-proof (e.g. when a new error is returned by > > hv_ringbuffer_peek). And

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

2015-07-22 Thread Dexuan Cui
> From: Vitaly Kuznetsov > Sent: Tuesday, July 21, 2015 22:07 > > diff --git a/drivers/hv/channel.c b/drivers/hv/channel.c >> ... > > +int vmbus_recvpacket_hvsock(struct vmbus_channel *channel, void *buffer, > > + u32 bufferlen, u32 *buffer_actual_len) > > +{ > > + struct vm

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

2015-07-21 Thread Vitaly Kuznetsov
Dexuan Cui writes: > This will be used by the coming net/hvsock driver. > > Signed-off-by: Dexuan Cui > --- > drivers/hv/channel.c | 133 > ++ > drivers/hv/hyperv_vmbus.h | 4 ++ > drivers/hv/ring_buffer.c | 14 + > include/linux/hyperv.