Subject: port-arm/23264: New i2c device match function matches all IOMD sub-devices
To: None <gnats-bugs@gnats.netbsd.org>
From: Mike Pumford <mpumford@black-star.demon.co.uk>
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
>Closed-Date:
>Last-Modified:
>Originator:     Mike Pumford
>Release:        NetBSD 1.6ZD
>Organization:
>Environment:
	
	
System: NetBSD black-star.demon.co.uk 1.6ZD NetBSD 1.6ZD (BSTAR_WS) #26: Fri Oct 24 23:06:57 BST 2003 mpumford@trigati.home.net:/work/src/sys/arch/acorn32/compile/obj.acorn32/BSTAR_WS acorn32
Architecture: arm
Machine: acorn32
>Description:
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.

>How-To-Repeat:
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

>Fix:
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----------------

>Release-Note:
>Audit-Trail:
>Unformatted: