summaryrefslogtreecommitdiff
path: root/sys/dev/fdt
diff options
context:
space:
mode:
authorPatrick Wildt <patrick@cvs.openbsd.org>2020-04-27 11:41:32 +0000
committerPatrick Wildt <patrick@cvs.openbsd.org>2020-04-27 11:41:32 +0000
commit53cde89e631da8b736408ac1dc8ea4d141e30382 (patch)
treec878a8ea166aa5b29b7eb1e1f480c71761f79395 /sys/dev/fdt
parent9e60f63b1dfefdb2df994b74559f026905c712e1 (diff)
Free the "ranges" array in the error handling paths.
ok kettenis@
Diffstat (limited to 'sys/dev/fdt')
-rw-r--r--sys/dev/fdt/dwpcie.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/sys/dev/fdt/dwpcie.c b/sys/dev/fdt/dwpcie.c
index f10a654dc7b..195e11e5c81 100644
--- a/sys/dev/fdt/dwpcie.c
+++ b/sys/dev/fdt/dwpcie.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dwpcie.c,v 1.18 2020/04/26 15:17:21 patrick Exp $ */
+/* $OpenBSD: dwpcie.c,v 1.19 2020/04/27 11:41:31 patrick Exp $ */
/*
* Copyright (c) 2018 Mark Kettenis <kettenis@openbsd.org>
*
@@ -325,6 +325,8 @@ dwpcie_attach(struct device *parent, struct device *self, void *aux)
if (bus_space_map(sc->sc_iot, faa->fa_reg[0].addr,
faa->fa_reg[0].size, 0, &sc->sc_ioh)) {
+ free(sc->sc_ranges, M_TEMP, sc->sc_nranges *
+ sizeof(struct dwpcie_range));
printf(": can't map ctrl registers\n");
return;
}
@@ -337,6 +339,8 @@ dwpcie_attach(struct device *parent, struct device *self, void *aux)
if (bus_space_map(sc->sc_iot, sc->sc_cfg0_base,
sc->sc_cfg1_size, 0, &sc->sc_cfg0_ioh)) {
bus_space_unmap(sc->sc_iot, sc->sc_ioh, faa->fa_reg[0].size);
+ free(sc->sc_ranges, M_TEMP, sc->sc_nranges *
+ sizeof(struct dwpcie_range));
printf(": can't map config registers\n");
return;
}
@@ -345,6 +349,8 @@ dwpcie_attach(struct device *parent, struct device *self, void *aux)
sc->sc_cfg1_size, 0, &sc->sc_cfg1_ioh)) {
bus_space_unmap(sc->sc_iot, sc->sc_cfg0_ioh, sc->sc_cfg0_size);
bus_space_unmap(sc->sc_iot, sc->sc_ioh, faa->fa_reg[0].size);
+ free(sc->sc_ranges, M_TEMP, sc->sc_nranges *
+ sizeof(struct dwpcie_range));
printf(": can't map config registers\n");
return;
}