public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
From: Bart Van Assche <Bart.VanAssche@wdc.com>
To: "jgg@ziepe.ca" <jgg@ziepe.ca>, "leon@kernel.org" <leon@kernel.org>
Cc: "linux-rdma@vger.kernel.org" <linux-rdma@vger.kernel.org>,
	"stable@vger.kernel.org" <stable@vger.kernel.org>,
	"dledford@redhat.com" <dledford@redhat.com>
Subject: Re: [PATCH] IB/core: Fix two kernel warnings triggered by rxe registration
Date: Wed, 3 Jan 2018 17:08:51 +0000	[thread overview]
Message-ID: <1514999330.2582.8.camel@wdc.com> (raw)
In-Reply-To: <20171227225647.GJ25436@ziepe.ca>

On Wed, 2017-12-27 at 15:56 -0700, Jason Gunthorpe wrote:
> I'm a little more worried about the ib_device_register_sysfs - why was
> the WARN_ON ever there?

That WARN_ON() statement was introduced by commit 97a9ea848016 ("IB/core:
Initialize ib_device.dev.parent earlier"):

[ ... ]
diff --git a/drivers/infiniband/core/sysfs.c b/drivers/infiniband/core/sysfs.c
index c1fb545e8d78..daadf3130c9f 100644
--- a/drivers/infiniband/core/sysfs.c
+++ b/drivers/infiniband/core/sysfs.c
@@ -1258,7 +1258,7 @@ int ib_device_register_sysfs(struct ib_device *device,
        int ret;
        int i;
  
-       device->dev.parent = device->dma_device;
+       WARN_ON_ONCE(!device->dev.parent);
        ret = dev_set_name(class_dev, "%s", device->name);
        if (ret)
                return ret;
[ ... ]

Since ib_device_register_sysfs() does not use the parent pointer in any way
I think it is sufficient to check the parent pointer in ib_register_device()
and to leave out any parent pointer checks from ib_device_register_sysfs().

> What do you think about this as a clarification Bart?
> [ ... ]

OK, I will add a parent pointer check in the code paths that dereference that
pointer.

Bart.

      reply	other threads:[~2018-01-03 17:08 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-22 21:38 [PATCH] IB/core: Fix two kernel warnings triggered by rxe registration Bart Van Assche
2017-12-25 10:28 ` Leon Romanovsky
     [not found]   ` <20171225102839.GD2942-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org>
2017-12-27 22:56     ` Jason Gunthorpe
2018-01-03 17:08       ` Bart Van Assche [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=1514999330.2582.8.camel@wdc.com \
    --to=bart.vanassche@wdc.com \
    --cc=dledford@redhat.com \
    --cc=jgg@ziepe.ca \
    --cc=leon@kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=stable@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