[3.13.y.z extended stable] Patch "IB/qib: Fix debugfs ordering issue with multiple HCAs" has been added to staging queue

Kamal Mostafa kamal at canonical.com
Thu May 1 19:17:16 UTC 2014

This is a note to let you know that I have just added a patch titled

    IB/qib: Fix debugfs ordering issue with multiple HCAs

to the linux-3.13.y-queue branch of the 3.13.y.z extended stable tree 
which can be found at:


This patch is scheduled to be released in version

If you, or anyone else, feels it should not be added to this tree, please 
reply to this email.

For more information about the 3.13.y.z tree, see



>From 8dcdfa9d37ee39fb4580bd4776d906457874ffb9 Mon Sep 17 00:00:00 2001
From: Mike Marciniszyn <mike.marciniszyn at intel.com>
Date: Fri, 7 Mar 2014 08:32:31 -0500
Subject: IB/qib: Fix debugfs ordering issue with multiple HCAs

commit f8b6c47a44c063062317646683a73371c24c69ee upstream.

The debugfs init code was incorrectly called before the idr mechanism
is used to get the unit number, so the dd->unit hasn't been
initialized.  This caused the unit relative directory creation to fail
after the first.

This patch moves the init for the debugfs stuff until after all of the
failures and after the unit number has been determined.

A bug in unwind code in qib_alloc_devdata() is also fixed.

Reviewed-by: Dennis Dalessandro <dennis.dalessandro at intel.com>
Signed-off-by: Mike Marciniszyn <mike.marciniszyn at intel.com>
Signed-off-by: Roland Dreier <roland at purestorage.com>
Signed-off-by: Kamal Mostafa <kamal at canonical.com>
 drivers/infiniband/hw/qib/qib_init.c | 25 +++++++++++--------------
 1 file changed, 11 insertions(+), 14 deletions(-)

diff --git a/drivers/infiniband/hw/qib/qib_init.c b/drivers/infiniband/hw/qib/qib_init.c
index 24e802f..76c3e17 100644
--- a/drivers/infiniband/hw/qib/qib_init.c
+++ b/drivers/infiniband/hw/qib/qib_init.c
@@ -1097,14 +1097,10 @@ struct qib_devdata *qib_alloc_devdata(struct pci_dev *pdev, size_t extra)
 	int ret;

 	dd = (struct qib_devdata *) ib_alloc_device(sizeof(*dd) + extra);
-	if (!dd) {
-		dd = ERR_PTR(-ENOMEM);
-		goto bail;
-	}
+	if (!dd)
+		return ERR_PTR(-ENOMEM);

-	qib_dbg_ibdev_init(&dd->verbs_dev);
+	INIT_LIST_HEAD(&dd->list);

 	spin_lock_irqsave(&qib_devs_lock, flags);
@@ -1121,11 +1117,6 @@ struct qib_devdata *qib_alloc_devdata(struct pci_dev *pdev, size_t extra)
 	if (ret < 0) {
 			      "Could not allocate unit ID: error %d\n", -ret);
-		qib_dbg_ibdev_exit(&dd->verbs_dev);
-		ib_dealloc_device(&dd->verbs_dev.ibdev);
-		dd = ERR_PTR(ret);
 		goto bail;

@@ -1139,9 +1130,15 @@ struct qib_devdata *qib_alloc_devdata(struct pci_dev *pdev, size_t extra)
 				"Could not alloc cpulist info, cpu affinity might be wrong\n");
+	qib_dbg_ibdev_init(&dd->verbs_dev);
 	return dd;
+	if (!list_empty(&dd->list))
+		list_del_init(&dd->list);
+	ib_dealloc_device(&dd->verbs_dev.ibdev);
+	return ERR_PTR(ret);;


More information about the kernel-team mailing list