Properly release allocated resources if adw(4) device fails to fully attach,

eg. if the firmware load fails.  Shortish MFC timeout so this can be merged
before the 4.11 freeze.

PR:		kern/34306
Submitted by:	gibbs
Approved by:	gibbs, imp (mentor)
MFC after:	5 days
This commit is contained in:
Scott Mitchell 2004-12-06 23:17:04 +00:00
parent 2f6a1b4744
commit fb805ea785
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=138502

View File

@ -872,6 +872,26 @@ adw_free(struct adw_softc *adw)
case 0:
break;
}
if (adw->regs != NULL)
bus_release_resource(adw->device,
adw->regs_res_type,
adw->regs_res_id,
adw->regs);
if (adw->irq != NULL)
bus_release_resource(adw->device,
adw->irq_res_type,
0, adw->irq);
if (adw->sim != NULL) {
if (adw->path != NULL) {
xpt_async(AC_LOST_DEVICE, adw->path, NULL);
xpt_free_path(adw->path);
}
xpt_bus_deregister(cam_sim_path(adw->sim));
cam_sim_free(adw->sim, /*free_devq*/TRUE);
}
free(adw->name, M_DEVBUF);
free(adw, M_DEVBUF);
}