Module Name: src
Committed By: jdolecek
Date: Thu Jun 25 14:52:00 UTC 2020
Modified Files:
src/sys/arch/powerpc/booke/dev: pq3obio.c
Log Message:
avoid variable-length array
To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/powerpc/booke/dev/pq3obio.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/arch/powerpc/booke/dev/pq3obio.c
diff -u src/sys/arch/powerpc/booke/dev/pq3obio.c:1.3 src/sys/arch/powerpc/booke/dev/pq3obio.c:1.4
--- src/sys/arch/powerpc/booke/dev/pq3obio.c:1.3 Sat May 28 05:27:20 2011
+++ src/sys/arch/powerpc/booke/dev/pq3obio.c Thu Jun 25 14:52:00 2020
@@ -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 @@ __KERNEL_RCSID(0, "$NetBSD: pq3obio.c,v
#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 @@ pq3obio_attach(device_t parent, device_t
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 @@ pq3obio_attach(device_t parent, device_t
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;