Subject: Re: 'wdc0 at isa0...' panics in -current
To: Manuel Bouyer <bouyer@antioche.eu.org>
From: Jared D. McNeill <jmcneill@invisible.yi.org>
List: current-users
Date: 01/14/2002 16:58:03
Manuel Bouyer wrote:

>Can you try to compile with DDB and see where it fails ?
>
The panic is due to chp->wdc being dereferences in a certain place even 
if it is NULL. The appended patch worked for me, but it's not an ideal 
solution.

Jared


Index: wdc.c
===================================================================
RCS file: /cvsroot/syssrc/sys/dev/ic/wdc.c,v
retrieving revision 1.107
diff -u -r1.107 wdc.c
--- wdc.c       2002/01/07 22:11:17     1.107
+++ wdc.c       2002/01/14 20:58:55
@@ -242,7 +242,8 @@
        bus_space_write_1(chp->ctl_iot, chp->ctl_ioh, wd_aux_ctlr, 
WDCTL_4BIT);
        delay(10);
 
-       ret_value = __wdcwait_reset(chp, ret_value);
+       if (chp->wdc)
+               ret_value = __wdcwait_reset(chp, ret_value);
        WDCDEBUG_PRINT(("%s:%d: after reset, ret_value=0x%d\n",
            chp->wdc ? chp->wdc->sc_dev.dv_xname : "wdcprobe", chp->channel,
            ret_value), DEBUG_PROBE);
@@ -276,7 +277,7 @@
                            chp->channel, drive), DEBUG_PROBE);
                        break;
                }
-               if (chp->wdc->cap & WDC_CAPABILITY_SELECT)
+               if (chp->wdc && chp->wdc->cap & WDC_CAPABILITY_SELECT)
                        chp->wdc->select(chp,drive);
                bus_space_write_1(chp->cmd_iot, chp->cmd_ioh, wd_sdh,
                    WDSD_IBM | (drive << 4));