If we fail a sanity check for the resources just allocated, make sure

that we free that resource.  All the other resources are freed in
their own routine, but since we haven't saved a pointer to this one,
it is leaked.  This is the failure case that lead to the sio ports
that weren't working, I think.
This commit is contained in:
Warner Losh 2005-03-15 08:02:47 +00:00
parent 291aa5d7f7
commit 356eadcdd6

View File

@ -98,8 +98,10 @@ fdc_isa_alloc_resources(device_t dev, struct fdc_data *fdc)
* check resource ranges.
*/
i = rman_get_start(res) & 0x7;
if (i + rman_get_size(res) - 1 > FDC_MAXREG)
if (i + rman_get_size(res) - 1 > FDC_MAXREG) {
bus_release_resource(dev, SYS_RES_IOPORT, newrid, res);
return (ENXIO);
}
for (j = 0; j < rman_get_size(res); j++) {
fdc->resio[i + j] = res;
fdc->ridio[i + j] = newrid;