armv7: Fix BeagleBone Black panic on system start

There is now assertion which requires all memory allocations of positive size.
Negative and zero-sized allocations lead to panic, so plug them off.

Reviewed by:	imp, emaste
Differential Revision:	https://reviews.freebsd.org/D39846
This commit is contained in:
Konrad Sewiłło-Jopek 2023-04-28 22:03:38 +02:00 committed by Emmanuel Vadot
parent 2544b8e00c
commit d43bf55fc5

View File

@ -306,6 +306,9 @@ parse_regfields(struct ti_sysc_softc *sc) {
/* Grab the content of reg properties */
nreg = OF_getproplen(node, "reg");
if (nreg <= 0)
return (ENXIO);
reg = malloc(nreg, M_DEVBUF, M_WAITOK);
OF_getencprop(node, "reg", reg, nreg);