Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/powerpc/booke/dev avoid variable-length array
details: https://anonhg.NetBSD.org/src/rev/ca5d5234025e
branches: trunk
changeset: 973264:ca5d5234025e
user: jdolecek <jdolecek%NetBSD.org@localhost>
date: Thu Jun 25 14:52:00 2020 +0000
description:
avoid variable-length array
diffstat:
sys/arch/powerpc/booke/dev/pq3obio.c | 12 +++++++-----
1 files changed, 7 insertions(+), 5 deletions(-)
diffs (49 lines):
diff -r b3b495ea7257 -r ca5d5234025e sys/arch/powerpc/booke/dev/pq3obio.c
--- a/sys/arch/powerpc/booke/dev/pq3obio.c Thu Jun 25 14:24:45 2020 +0000
+++ b/sys/arch/powerpc/booke/dev/pq3obio.c Thu Jun 25 14:52:00 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pq3obio.c,v 1.3 2011/05/28 05:27:20 matt Exp $ */
+/* $NetBSD: pq3obio.c,v 1.4 2020/06/25 14:52:00 jdolecek Exp $ */
/*-
* Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -40,7 +40,7 @@
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pq3obio.c,v 1.3 2011/05/28 05:27:20 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pq3obio.c,v 1.4 2020/06/25 14:52:00 jdolecek Exp $");
#include <sys/param.h>
#include <sys/device.h>
@@ -53,6 +53,8 @@
#include <powerpc/booke/e500reg.h>
#include <powerpc/booke/obiovar.h>
+#define OBIO_PORTS 8
+
static int pq3obio_match(device_t, cfdata_t, void *);
static void pq3obio_attach(device_t, device_t, void *);
@@ -189,7 +191,7 @@
return;
}
- for (u_int i = 0; i < 8; i++) {
+ for (u_int i = 0; i < OBIO_PORTS; i++) {
struct pq3lbc_softc * const lbc = &sc->sc_lbcs[i];
uint32_t br = bus_space_read_4(sc->sc_bst, sc->sc_bsh, BRn(i));
if (br & BR_V) {
@@ -210,10 +212,10 @@
t->pbs_limit = 0;
t->pbs_flags = _BUS_SPACE_BIG_ENDIAN;
- u_int sorted[found];
+ u_int sorted[OBIO_PORTS];
u_int nsorted = 0;
- for (u_int i = 0; i < 8; i++) {
+ for (u_int i = 0; i < OBIO_PORTS; i++) {
struct pq3lbc_softc * const lbc = &sc->sc_lbcs[i];
if ((lbc->lbc_br & BR_V) == 0)
continue;
Home |
Main Index |
Thread Index |
Old Index