Skip to content

Commit

Permalink
IB/qib: Clean up properly if qib_init() fails
Browse files Browse the repository at this point in the history
If qib_init() fails, the driver fails to free memory, unregister
device files, and unregister with the PCIe framework. The driver will
unload without error but a subsequent driver load will cause the
system to panic.  This was found by changing the 7220 code to load the
serdes microcode separately and not installing the microcode file.

Signed-off-by: Ralph Campbell <ralph.campbell@qlogic.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
  • Loading branch information
Ralph Campbell authored and Roland Dreier committed Jul 6, 2010
1 parent 950aff5 commit 756a33b
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions drivers/infiniband/hw/qib/qib_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -1289,8 +1289,18 @@ static int __devinit qib_init_one(struct pci_dev *pdev,

if (qib_mini_init || initfail || ret) {
qib_stop_timers(dd);
flush_scheduled_work();
for (pidx = 0; pidx < dd->num_pports; ++pidx)
dd->f_quiet_serdes(dd->pport + pidx);
if (qib_mini_init)
goto bail;
if (!j) {
(void) qibfs_remove(dd);
qib_device_remove(dd);
}
if (!ret)
qib_unregister_ib_device(dd);
qib_postinit_cleanup(dd);
if (initfail)
ret = initfail;
goto bail;
Expand Down

0 comments on commit 756a33b

Please sign in to comment.