linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg@ziepe.ca>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: linux-rdma@vger.kernel.org
Subject: Re: [bug report] RDMA/devices: Re-organize device.c locking
Date: Wed, 25 Aug 2021 13:34:18 -0300	[thread overview]
Message-ID: <20210825163418.GZ543798@ziepe.ca> (raw)
In-Reply-To: <20210810085252.GC23998@kili>

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

      reply	other threads:[~2021-08-25 16:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-10  9:18 [bug report] RDMA/devices: Re-organize device.c locking Dan Carpenter
2021-08-25 16:34 ` Jason Gunthorpe [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210825163418.GZ543798@ziepe.ca \
    --to=jgg@ziepe.ca \
    --cc=dan.carpenter@oracle.com \
    --cc=linux-rdma@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).