Re: [PATCH] IB/usnic: Handle 0 counts in resource allocation

2015-12-23 Thread Doug Ledford
On 12/09/2015 01:42 PM, Nelson Escobar wrote: > Signed-off-by: Dave Goodell > Reviewed-by: Reese Faucette > Reviewed-by: Xuyang Wang > Signed-off-by: Nelson Escobar > --- > drivers/infiniband/hw/usnic/usnic_vnic.c

Re: [PATCH] IB/usnic: Handle 0 counts in resource allocation

2015-12-11 Thread Leon Romanovsky
> Thanks for looking at the code. I am still not understanding your point. >> Old code: >> usnic_vnic_res_free_cnt(vnic, type) == 0 and cnt == 1 will return EINVAL > Yes: > if (0 < 1 || 1 < 1 || !owner) > return -EINVAL; >> New code >> snic_vnic_res_free_cnt(vnic, type) ==

Re: [PATCH] IB/usnic: Handle 0 counts in resource allocation

2015-12-10 Thread Nelson Escobar
On 12/9/2015 10:47 PM, Leon Romanovsky wrote: > On Wed, Dec 09, 2015 at 10:42:19AM -0800, Nelson Escobar wrote: >> -if (usnic_vnic_res_free_cnt(vnic, type) < cnt || cnt < 1 || !owner) >> +if (usnic_vnic_res_free_cnt(vnic, type) < cnt || cnt < 0 || !owner) > Before this change you returned

Re: [PATCH] IB/usnic: Handle 0 counts in resource allocation

2015-12-10 Thread l...@leon.nu
On Thu, Dec 10, 2015 at 11:22:24AM -0800, Nelson Escobar wrote: > On 12/9/2015 10:47 PM, Leon Romanovsky wrote: > > On Wed, Dec 09, 2015 at 10:42:19AM -0800, Nelson Escobar wrote: > >> - if (usnic_vnic_res_free_cnt(vnic, type) < cnt || cnt < 1 || !owner) > >> + if (usnic_vnic_res_free_cnt(vnic,

Re: [PATCH] IB/usnic: Handle 0 counts in resource allocation

2015-12-10 Thread Nelson Escobar
On 12/10/2015 11:47 AM, l...@leon.nu wrote: > On Thu, Dec 10, 2015 at 11:22:24AM -0800, Nelson Escobar wrote: >> On 12/9/2015 10:47 PM, Leon Romanovsky wrote: >>> On Wed, Dec 09, 2015 at 10:42:19AM -0800, Nelson Escobar wrote: - if (usnic_vnic_res_free_cnt(vnic, type) < cnt || cnt < 1 ||

[PATCH] IB/usnic: Handle 0 counts in resource allocation

2015-12-09 Thread Nelson Escobar
Signed-off-by: Dave Goodell Reviewed-by: Reese Faucette Reviewed-by: Xuyang Wang Signed-off-by: Nelson Escobar --- drivers/infiniband/hw/usnic/usnic_vnic.c | 54 +--- 1 file changed, 29

Re: [PATCH] IB/usnic: Handle 0 counts in resource allocation

2015-12-09 Thread Leon Romanovsky
On Wed, Dec 09, 2015 at 10:42:19AM -0800, Nelson Escobar wrote: > - if (usnic_vnic_res_free_cnt(vnic, type) < cnt || cnt < 1 || !owner) > + if (usnic_vnic_res_free_cnt(vnic, type) < cnt || cnt < 0 || !owner) Before this change you returned EINVAL if no free_cnt were available, now you will