Fix attach errors handling.
Found with: Coverity Prevent(tm) CID: 3477
This commit is contained in:
parent
3e6ce93ee1
commit
b136465250
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=208816
@ -478,9 +478,9 @@ siis_ch_attach(device_t dev)
|
||||
rid = ATA_IRQ_RID;
|
||||
if (!(ch->r_irq = bus_alloc_resource_any(dev, SYS_RES_IRQ,
|
||||
&rid, RF_SHAREABLE | RF_ACTIVE))) {
|
||||
bus_release_resource(dev, SYS_RES_MEMORY, ch->unit, ch->r_mem);
|
||||
device_printf(dev, "Unable to map interrupt\n");
|
||||
return (ENXIO);
|
||||
error = ENXIO;
|
||||
goto err0;
|
||||
}
|
||||
if ((bus_setup_intr(dev, ch->r_irq, ATA_INTR_FLAGS, NULL,
|
||||
siis_ch_intr_locked, dev, &ch->ih))) {
|
||||
@ -499,9 +499,10 @@ siis_ch_attach(device_t dev)
|
||||
ch->sim = cam_sim_alloc(siisaction, siispoll, "siisch", ch,
|
||||
device_get_unit(dev), &ch->mtx, 2, SIIS_MAX_SLOTS, devq);
|
||||
if (ch->sim == NULL) {
|
||||
cam_simq_free(devq);
|
||||
device_printf(dev, "unable to allocate sim\n");
|
||||
error = ENOMEM;
|
||||
goto err2;
|
||||
goto err1;
|
||||
}
|
||||
if (xpt_bus_register(ch->sim, dev, 0) != CAM_SUCCESS) {
|
||||
device_printf(dev, "unable to register xpt bus\n");
|
||||
@ -523,6 +524,7 @@ siis_ch_attach(device_t dev)
|
||||
cam_sim_free(ch->sim, /*free_devq*/TRUE);
|
||||
err1:
|
||||
bus_release_resource(dev, SYS_RES_IRQ, ATA_IRQ_RID, ch->r_irq);
|
||||
err0:
|
||||
bus_release_resource(dev, SYS_RES_MEMORY, ch->unit, ch->r_mem);
|
||||
mtx_unlock(&ch->mtx);
|
||||
return (error);
|
||||
|
Loading…
Reference in New Issue
Block a user