From 36defc4bbb5f5e58b17e89e2f018eddcc55a9722 Mon Sep 17 00:00:00 2001 From: jsg Date: Mon, 14 Feb 2022 00:53:40 +0000 Subject: [PATCH] OF_getproplen() returns -1 on error, so don't store result in size_t ok kettenis@ --- sys/arch/arm64/dev/aplhidev.c | 4 ++-- sys/dev/fdt/imxspi.c | 6 +++--- 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 * Copyright (c) 2013-2014 joshua stein @@ -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 * @@ -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 * @@ -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; }; -- 2.20.1