summaryrefslogtreecommitdiffstats
path: root/sys/dev/fdc/fdc_isa.c
diff options
context:
space:
mode:
authorimp <imp@FreeBSD.org>2005-03-15 08:02:47 +0000
committerimp <imp@FreeBSD.org>2005-03-15 08:02:47 +0000
commita7b3bd456408d157545ff8c8ffd7060ae2070886 (patch)
treeef49c4f92a36a70322db975ec33f0e6d232f32c6 /sys/dev/fdc/fdc_isa.c
parentf6d2d1ffc3bad9fc7860fe1305b6ded4a28597c8 (diff)
downloadFreeBSD-src-a7b3bd456408d157545ff8c8ffd7060ae2070886.zip
FreeBSD-src-a7b3bd456408d157545ff8c8ffd7060ae2070886.tar.gz
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.
Diffstat (limited to 'sys/dev/fdc/fdc_isa.c')
-rw-r--r--sys/dev/fdc/fdc_isa.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/sys/dev/fdc/fdc_isa.c b/sys/dev/fdc/fdc_isa.c
index 68fee40..ab7057d 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;
OpenPOWER on IntegriCloud