Subject: Re: 'wdc0 at isa0...' panics in -current
To: Jared D. McNeill <jmcneill@invisible.yi.org>
From: Manuel Bouyer <bouyer@antioche.eu.org>
List: current-users
Date: 01/14/2002 22:11:53
On Mon, Jan 14, 2002 at 04:58:03PM -0400, Jared D. McNeill wrote:
> 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);

This is really strange, chp->wdc isn't used at all in __wdcwait_reset()
I'll compile a kernel on my box and see what happens.

>        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);

This one is rigth.

-- 
Manuel Bouyer <bouyer@antioche.eu.org>
--