Re: [bug report] RDMA/devices: Re-organize device.c locking

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

 



On Tue, Aug 10, 2021 at 12:18:42PM +0300, Dan Carpenter wrote:
> Hello Jason Gunthorpe,
> 
> The patch 921eab1143aa: "RDMA/devices: Re-organize device.c locking"
> from Feb 6, 2019, leads to the following static checker warning:
> 
> 	drivers/infiniband/core/device.c:712 add_client_context()
> 	warn: missing error code 'ret'
> 
> drivers/infiniband/core/device.c
>     689 static int add_client_context(struct ib_device *device,
>     690 			      struct ib_client *client)
>     691 {
>     692 	int ret = 0;
>     693 
>     694 	if (!device->kverbs_provider && !client->no_kverbs_req)
>     695 		return 0;
>     696 
>     697 	down_write(&device->client_data_rwsem);
>     698 	/*
>     699 	 * So long as the client is registered hold both the client and device
>     700 	 * unregistration locks.
>     701 	 */
>     702 	if (!refcount_inc_not_zero(&client->uses))
>     703 		goto out_unlock;
>     704 	refcount_inc(&device->refcount);
>     705 
>     706 	/*
>     707 	 * Another caller to add_client_context got here first and has already
>     708 	 * completely initialized context.
>     709 	 */
>     710 	if (xa_get_mark(&device->client_data, client->client_id,
>     711 		    CLIENT_DATA_REGISTERED))
> --> 712 		goto out;
> 
> Hard to tell if ret should be zero or negative.

It should be 0, this collision is success, the xarray has the correct
data, it was just put there by another thread.

Jason



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux