Subject: port-arm/23264: New i2c device match function matches all IOMD sub-devices
To: None <>
From: Mike Pumford <>
List: netbsd-bugs
Date: 10/25/2003 00:13:14
>Number:         23264
>Category:       port-arm
>Synopsis:       New i2c device match function matches all IOMD sub-devices
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    port-arm-maintainer
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Oct 24 23:14:00 UTC 2003
>Originator:     Mike Pumford
>Release:        NetBSD 1.6ZD
System: NetBSD 1.6ZD NetBSD 1.6ZD (BSTAR_WS) #26: Fri Oct 24 23:06:57 BST 2003 acorn32
Architecture: arm
Machine: acorn32
The new i2c code match function does not check the sub device name 
passed to the match function in the attach_args. This causes one correctly
mached iic0 device and 4 false positives corresponding to the other IOMD
subdevices. The kernel then panics when setting up the clock interrupts 
due to a lack of a clock IOMD sub-device.

Boot Kernel on acorn32 machine it will report 4 iic devices and will then
panic just after printing:
clock: hz=100 stathz = 0 profhz = 0

Make iomciic_match check the sub-device name properly. The attached patch
adds the appropriate check.

------------Cut Here----------------
Index: iomdiic.c
RCS file: /cvsroot/src/sys/arch/arm/iomd/iomdiic.c,v
retrieving revision 1.1
diff -u -r1.1 iomdiic.c
--- iomdiic.c   2003/10/06 16:11:19     1.1
+++ iomdiic.c   2003/10/19 23:50:16
@@ -121,8 +121,11 @@
 static int
 iomdiic_match(struct device *parent, struct cfdata *cf, void *aux)
+       struct iic_attach_args *ia = aux;
-       return (1);
+       if (strcmp(ia->ia_name, "iic") == 0)
+               return(1);
+       return(0);
 static void
------------Cut Here----------------