From 861b9568df963ccdf000b083ce686b9148ab83a5 Mon Sep 17 00:00:00 2001 From: tsutsui Date: Thu, 5 Oct 2006 09:34:52 +0000 Subject: [PATCH] Don't call wdc_init_shadow_regs() before struct ata_channel is properly initilized in wdc_obio_attach(). Fixes NULL pointer deref during boot. --- sys/arch/mac68k/obio/wdc_obio.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/arch/mac68k/obio/wdc_obio.c b/sys/arch/mac68k/obio/wdc_obio.c index 10e0405eb7f7..618b8f78967e 100644 --- a/sys/arch/mac68k/obio/wdc_obio.c +++ b/sys/arch/mac68k/obio/wdc_obio.c @@ -1,4 +1,4 @@ -/* $NetBSD: wdc_obio.c,v 1.21 2006/03/29 04:16:45 thorpej Exp $ */ +/* $NetBSD: wdc_obio.c,v 1.22 2006/10/05 09:34:52 tsutsui Exp $ */ /* * Copyright (c) 2002 Takeshi Shibagaki All rights reserved. @@ -32,7 +32,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: wdc_obio.c,v 1.21 2006/03/29 04:16:45 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wdc_obio.c,v 1.22 2006/10/05 09:34:52 tsutsui Exp $"); #include #include @@ -172,7 +172,6 @@ wdc_obio_attach(struct device *parent, struct device *self, void *aux) return; } } - wdc_init_shadow_regs(&sc->sc_channel); if (bus_space_subregion(wdr->cmd_iot, wdr->cmd_baseioh, @@ -230,6 +229,7 @@ wdc_obio_attach(struct device *parent, struct device *self, void *aux) chp->ch_atac = &sc->sc_wdcdev.sc_atac; chp->ch_queue = &sc->sc_chqueue; chp->ch_ndrive = 2; + wdc_init_shadow_regs(chp); printf("\n");