Return to BSD News archive
Received: by minnie.vk1xwt.ampr.org with NNTP id AA413 ; Sun, 31 Jan 93 14:06:52 EST Path: sserve!manuel.anu.edu.au!munnari.oz.au!sgiblab!zaphod.mps.ohio-state.edu!sol.ctr.columbia.edu!eff!enterpoop.mit.edu!ai-lab!hal.gnu.ai.mit.edu!mycroft From: mycroft@hal.gnu.ai.mit.edu (Charles Hannum) Newsgroups: comp.unix.bsd Subject: Re: [386bsd] error in wd.c? Date: 1 Feb 1993 11:00:30 GMT Organization: /etc/organization Lines: 78 Message-ID: <1kivseINN26g@life.ai.mit.edu> References: <1kh03lINNdpj@wzv.win.tue.nl> NNTP-Posting-Host: hal.ai.mit.edu In article <1kh03lINNdpj@wzv.win.tue.nl> guido@gvr.win.tue.nl (Guido van Rooij) writes: >My question: shouldn't there be the splx(x) not be placed at >the line marked with *** ? > > x = splbio(); /* not called from intr level ... */ > wdc = du->dk_port; > outb(wdc+wd_sdh, WDSD_IBM | (u << 4)); > stat = wdcommand(du, WDCC_READP); >*** > if (stat < 0) > return(stat); > if (stat & WDCS_ERR) { > splx(x); > return(inb(wdc+wd_error)); > } I doubt there is any question that both of the ifs need a splx(), but I think that the latter one should go after the inb(). A patch: *** wd.c.~1~ Mon Jan 25 01:28:39 1993 --- wd.c Mon Feb 1 05:58:00 1993 *************** *** 909,916 **** outb(wdc+wd_seccnt, du->dk_dd.d_nsectors); stat = wdcommand(du, WDCC_IDC); ! if (stat < 0) return(stat); if (stat & WDCS_ERR) printf("wdsetctlr: status %b error %b\n", stat, WDCS_BITS, inb(wdc+wd_error), WDERR_BITS); --- 909,918 ---- outb(wdc+wd_seccnt, du->dk_dd.d_nsectors); stat = wdcommand(du, WDCC_IDC); ! if (stat < 0) { ! splx(x); return(stat); + } if (stat & WDCS_ERR) printf("wdsetctlr: status %b error %b\n", stat, WDCS_BITS, inb(wdc+wd_error), WDERR_BITS); *************** *** 932,942 **** outb(wdc+wd_sdh, WDSD_IBM | (u << 4)); stat = wdcommand(du, WDCC_READP); ! if (stat < 0) return(stat); if (stat & WDCS_ERR) { splx(x); ! return(inb(wdc+wd_error)); } /* obtain parameters */ --- 934,947 ---- outb(wdc+wd_sdh, WDSD_IBM | (u << 4)); stat = wdcommand(du, WDCC_READP); ! if (stat < 0) { ! splx(x); return(stat); + } if (stat & WDCS_ERR) { + stat = inb(wdc+wd_error); splx(x); ! return(stat); } /* obtain parameters */ -- \ / Charles Hannum, mycroft@ai.mit.edu /\ \ PGP public key available on request. MIME, AMS, NextMail accepted. Scheme White heterosexual atheist male (WHAM) pride!