Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/i2c Iterate over ia_ncompat array properly.
details: https://anonhg.NetBSD.org/src/rev/be57caff0692
branches: trunk
changeset: 347665:be57caff0692
user: jakllsch <jakllsch%NetBSD.org@localhost>
date: Sat Sep 10 13:16:12 2016 +0000
description:
Iterate over ia_ncompat array properly.
diffstat:
sys/dev/i2c/at24cxx.c | 15 +++++++++------
1 files changed, 9 insertions(+), 6 deletions(-)
diffs (43 lines):
diff -r ec995b5824de -r be57caff0692 sys/dev/i2c/at24cxx.c
--- a/sys/dev/i2c/at24cxx.c Sat Sep 10 11:04:24 2016 +0000
+++ b/sys/dev/i2c/at24cxx.c Sat Sep 10 13:16:12 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: at24cxx.c,v 1.22 2016/07/23 18:02:10 jakllsch Exp $ */
+/* $NetBSD: at24cxx.c,v 1.23 2016/09/10 13:16:12 jakllsch Exp $ */
/*
* Copyright (c) 2003 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: at24cxx.c,v 1.22 2016/07/23 18:02:10 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: at24cxx.c,v 1.23 2016/09/10 13:16:12 jakllsch Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -150,7 +150,7 @@
{
struct seeprom_softc *sc = device_private(self);
struct i2c_attach_args *ia = aux;
- u_int n;
+ u_int n, m;
sc->sc_tag = ia->ia_tag;
sc->sc_address = ia->ia_addr;
@@ -185,9 +185,12 @@
if (sc->sc_size <= 0 && ia->ia_ncompat > 0) {
for (n = 0; n < __arraycount(seeprom_sizes); n++) {
- if (!strcmp(seeprom_sizes[n].name, ia->ia_compat[n])) {
- sc->sc_size = seeprom_sizes[n].size;
- break;
+ for (m = 0; m < ia->ia_ncompat; m++) {
+ if (!strcmp(seeprom_sizes[n].name,
+ ia->ia_compat[m])) {
+ sc->sc_size = seeprom_sizes[n].size;
+ break;
+ }
}
}
}
Home |
Main Index |
Thread Index |
Old Index