Fix 2 bugs in mxge_attach()

- Don't leak slice resources when mxge_alloc_rings() fails

- Start taskq threads only after we know attach will succeed.  At
  boot time, taskqueue_terminate() will loop infinately, waiting
  for the threads to exit, and hang the system.

Submitted by: Panasas
MFC After: 3 days
This commit is contained in:
Andrew Gallatin 2010-03-17 20:13:09 +00:00
parent cb2f0c8ce1
commit 2e08479882
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=205255

View file

@ -4616,8 +4616,6 @@ mxge_attach(device_t dev)
err = ENOMEM;
goto abort_with_nothing;
}
taskqueue_start_threads(&sc->tq, 1, PI_NET, "%s taskq",
device_get_nameunit(sc->dev));
err = bus_dma_tag_create(NULL, /* parent */
1, /* alignment */
@ -4723,7 +4721,7 @@ mxge_attach(device_t dev)
err = mxge_alloc_rings(sc);
if (err != 0) {
device_printf(sc->dev, "failed to allocate rings\n");
goto abort_with_dmabench;
goto abort_with_slices;
}
err = mxge_add_irq(sc);
@ -4781,6 +4779,8 @@ mxge_attach(device_t dev)
ifp->if_transmit = mxge_transmit;
ifp->if_qflush = mxge_qflush;
#endif
taskqueue_start_threads(&sc->tq, 1, PI_NET, "%s taskq",
device_get_nameunit(sc->dev));
callout_reset(&sc->co_hdl, mxge_ticks, mxge_tick, sc);
return 0;