Subject: kern/23140: an(4) attach printf error ambiguity
To: None <gnats-bugs@gnats.NetBSD.org>
From: None <lavalamp@spiritual-machines.org>
List: netbsd-bugs
Date: 10/12/2003 18:09:31
>Number:         23140
>Category:       kern
>Synopsis:       an(4) attach printf error ambiguity
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Oct 12 18:10:01 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     Seklecki, Brian A.
>Release:        -current (1.6Z?)
>Organization:
Spiritual Machines
>Environment:
it's a custom INSTALL_LAPTOP kernel i'm working with
>Description:
The problem is that there are four functions called from an_attach() in sys/dev/ic/an.c that output the exact same error making troubleshooting a bit difficult:

http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/dev/ic/an.c?rev=1.26&content-type=text/x-cvsweb-markup

/* Read the current configuration */ 
        sc->an_config.an_type = AN_RID_GENCONFIG;
        sc->an_config.an_len = sizeof(struct an_ltv_genconfig);
        if (an_read_record(sc, (struct an_ltv_gen *)&sc->an_config)) {
                splx(s);
                aprint_error("%s: read record failed\n", sc->an_dev.dv_xname);
                return(EIO);
        }

        /* Read the card capabilities */
        sc->an_caps.an_type = AN_RID_CAPABILITIES;
        sc->an_caps.an_len = sizeof(struct an_ltv_caps);
        if (an_read_record(sc, (struct an_ltv_gen *)&sc->an_caps)) {
                splx(s);
                aprint_error("%s: read record failed\n", sc->an_dev.dv_xname);
                return(EIO);
        }

        /* Read ssid list */
        sc->an_ssidlist.an_type = AN_RID_SSIDLIST;
        sc->an_ssidlist.an_len = sizeof(struct an_ltv_ssidlist);
        if (an_read_record(sc, (struct an_ltv_gen *)&sc->an_ssidlist)) {
                splx(s);
                aprint_error("%s: read record failed\n", sc->an_dev.dv_xname);
                return(EIO);
        }

        /* Read AP list */
        sc->an_aplist.an_type = AN_RID_APLIST;
        sc->an_aplist.an_len = sizeof(struct an_ltv_aplist);
        if (an_read_record(sc, (struct an_ltv_gen *)&sc->an_aplist)) {
                splx(s);
                aprint_error("%s: read record failed\n", sc->an_dev.dv_xname);
return(EIO);


...this is unchanged in the OpenBSD version as well(1).  I'm in the
process of denoting the aprint_errors's to thier cooresponding data
structures and recompiling.

-Brian

1.
http://www.openbsd.org/cgi-bin/cvsweb/src/sys/dev/ic/an.c?rev=1.33&content-type=text/x-cvsweb-markup

--
>How-To-Repeat:
Boot -current kernel on a laptop (INSTALL_LAPTOP), insert a Cisco Aironet PCMCIA card and watch it not work (due to an unrelated problem).  See error message.  Try to debug by looking at code.  Realize 1 of 4 conditions could produce error.  See below/above.
>Fix:

# diff -u an.c_orig an.c      

-- an.c_orig   2003-10-12 10:25:56.000000000 -0400
+++ an.c        2003-10-12 10:24:30.000000000 -0400
@@ -214,7 +214,7 @@
        sc->an_config.an_len = sizeof(struct an_ltv_genconfig);
        if (an_read_record(sc, (struct an_ltv_gen *)&sc->an_config)) {
                splx(s);
-               aprint_error("%s: read record failed\n",
sc->an_dev.dv_xname);
+               aprint_error("%s: read record failed for sc->an_config
(Current Configuration)\n", sc->an_dev.dv_xname);
                return(EIO);
        }

@@ -223,7 +223,7 @@
        sc->an_caps.an_len = sizeof(struct an_ltv_caps);
        if (an_read_record(sc, (struct an_ltv_gen *)&sc->an_caps)) {
                splx(s);
-               aprint_error("%s: read record failed\n",
sc->an_dev.dv_xname);
+               aprint_error("%s: read record failed for sc->an_caps
(Card Capabilties)\n", sc->an_dev.dv_xname);
                return(EIO);
        }

@@ -232,7 +232,7 @@
        sc->an_ssidlist.an_len = sizeof(struct an_ltv_ssidlist);
        if (an_read_record(sc, (struct an_ltv_gen *)&sc->an_ssidlist)) {
                splx(s);
-               aprint_error("%s: read record failed\n",
sc->an_dev.dv_xname);
+               aprint_error("%s: read record failed for sc->an_ssidlist
(SSID List)\n", sc->an_dev.dv_xname);
                return(EIO);
        }

@@ -241,7 +241,7 @@
        sc->an_aplist.an_len = sizeof(struct an_ltv_aplist);
        if (an_read_record(sc, (struct an_ltv_gen *)&sc->an_aplist)) {
                splx(s);
-               aprint_error("%s: read record failed\n",
sc->an_dev.dv_xname);
+               aprint_error("%s: read record failed for sc->an_aplist
(AP List)\n", sc->an_dev.dv_xname);
                return(EIO);
        }

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