diff options
author | Jonathan Gray <jsg@cvs.openbsd.org> | 2022-02-14 00:53:41 +0000 |
---|---|---|
committer | Jonathan Gray <jsg@cvs.openbsd.org> | 2022-02-14 00:53:41 +0000 |
commit | 8a04ae2c0b7efaea60deed0a4d5165569f0541ec (patch) | |
tree | da83a3f47606983cec40032914dc0b5571e58a95 /sys | |
parent | 87de0daa971d1e149fa18688b4d4d3a82b506252 (diff) |
OF_getproplen() returns -1 on error, so don't store result in size_t
ok kettenis@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/arm64/dev/aplhidev.c | 4 | ||||
-rw-r--r-- | sys/dev/fdt/imxspi.c | 6 | ||||
-rw-r--r-- | sys/dev/fdt/simpleamp.c | 4 |
3 files changed, 7 insertions, 7 deletions
diff --git a/sys/arch/arm64/dev/aplhidev.c b/sys/arch/arm64/dev/aplhidev.c index 884069ead13..4368932d1e2 100644 --- a/sys/arch/arm64/dev/aplhidev.c +++ b/sys/arch/arm64/dev/aplhidev.c @@ -1,4 +1,4 @@ -/* $OpenBSD: aplhidev.c,v 1.4 2021/12/11 20:36:26 kettenis Exp $ */ +/* $OpenBSD: aplhidev.c,v 1.5 2022/02/14 00:53:40 jsg Exp $ */ /* * Copyright (c) 2021 Mark Kettenis <kettenis@openbsd.org> * Copyright (c) 2013-2014 joshua stein <jcs@openbsd.org> @@ -117,7 +117,7 @@ struct aplhidev_softc { uint8_t sc_msgid; uint32_t *sc_gpio; - size_t sc_gpiolen; + int sc_gpiolen; struct device *sc_kbd; uint8_t sc_kbddesc[APLHIDEV_DESC_MAX]; diff --git a/sys/dev/fdt/imxspi.c b/sys/dev/fdt/imxspi.c index 3c07fe68b17..705baaeae61 100644 --- a/sys/dev/fdt/imxspi.c +++ b/sys/dev/fdt/imxspi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: imxspi.c,v 1.3 2021/10/31 15:12:00 kettenis Exp $ */ +/* $OpenBSD: imxspi.c,v 1.4 2022/02/14 00:53:40 jsg Exp $ */ /* * Copyright (c) 2018 Patrick Wildt <patrick@blueri.se> * @@ -91,7 +91,7 @@ struct imxspi_softc { int sc_node; uint32_t *sc_gpio; - size_t sc_gpiolen; + int sc_gpiolen; struct rwlock sc_buslock; struct spi_controller sc_tag; @@ -179,7 +179,7 @@ imxspi_attachhook(struct device *self) clock_enable(sc->sc_node, NULL); sc->sc_gpiolen = OF_getproplen(sc->sc_node, "cs-gpios"); - if (sc->sc_gpiolen) { + if (sc->sc_gpiolen > 0) { sc->sc_gpio = malloc(sc->sc_gpiolen, M_DEVBUF, M_WAITOK); OF_getpropintarray(sc->sc_node, "cs-gpios", sc->sc_gpio, sc->sc_gpiolen); diff --git a/sys/dev/fdt/simpleamp.c b/sys/dev/fdt/simpleamp.c index 7422d3d2423..1d49d65c401 100644 --- a/sys/dev/fdt/simpleamp.c +++ b/sys/dev/fdt/simpleamp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: simpleamp.c,v 1.1 2020/06/10 23:59:07 patrick Exp $ */ +/* $OpenBSD: simpleamp.c,v 1.2 2022/02/14 00:53:40 jsg Exp $ */ /* * Copyright (c) 2020 Patrick Wildt <patrick@blueri.se> * @@ -42,7 +42,7 @@ struct simpleamp_softc { struct dai_device sc_dai; uint32_t *sc_gpio; - size_t sc_gpiolen; + int sc_gpiolen; uint32_t sc_vcc; }; |