On Thu, Sep 14, 2017 at 09:23:53AM +0530, Somnath Kotur wrote: > Hi Leon, > > On Wed, Sep 13, 2017 at 11:12 PM, Leon Romanovsky wrote: > > On Thu, Aug 31, 2017 at 09:27:31AM +0530, Somnath Kotur wrote: > >> Clean up all devices added to the bnxt_re_dev_list in the > >> module_exit entry point. > >> > >> Signed-off-by: Somnath Kotur > >> --- > >> drivers/infiniband/hw/bnxt_re/main.c | 16 ++++++++++++++++ > >> 1 file changed, 16 insertions(+) > >> > >> diff --git a/drivers/infiniband/hw/bnxt_re/main.c b/drivers/infiniband/hw/bnxt_re/main.c > >> index 82d1cbc..00a3b74 100644 > >> --- a/drivers/infiniband/hw/bnxt_re/main.c > >> +++ b/drivers/infiniband/hw/bnxt_re/main.c > >> @@ -1375,6 +1375,22 @@ static int __init bnxt_re_mod_init(void) > >> > >> static void __exit bnxt_re_mod_exit(void) > >> { > >> + struct bnxt_re_dev *rdev; > >> + LIST_HEAD(to_be_deleted); > >> + > >> + mutex_lock(&bnxt_re_dev_lock); > >> + /* Free all adapter allocated resources */ > >> + if (!list_empty(&bnxt_re_dev_list)) > > > > Hi Somnath, > > > > How is it possible to have the bnxt_re_dev_list to be empty at this > > stage? Doesn't the call to bnxt_re_mod_exit mean that at least one entry > > exists? > Well, there is a possibility that NETDEV_UNREGISTER got invoked (not > via rmmod , but via the pci-sysfs route) > and this list is empty by the time rmmod of the bnxt_re was invoked. I was under impression that calls to bnxt_re_ib_unreg() and bnxt_re_remove_one() in NETDEV_UNREGISTER should eliminate such scenario. Thanks > > Thanks > Som