From 356eadcdd653af5652c3a715c98d9b1c58e4dbe0 Mon Sep 17 00:00:00 2001 From: Warner Losh Date: Tue, 15 Mar 2005 08:02:47 +0000 Subject: [PATCH] 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. --- sys/dev/fdc/fdc_isa.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sys/dev/fdc/fdc_isa.c b/sys/dev/fdc/fdc_isa.c index 68fee402fb80..ab7057d260b4 100644 --- a/sys/dev/fdc/fdc_isa.c +++ b/sys/dev/fdc/fdc_isa.c @@ -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;