Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 15 Feb 2003 22:33:42 -0800 (PST)
From:      Nate Lawson <nate@root.org>
To:        "Matthew N. Dodd" <winter@jurai.net>
Cc:        current@FreeBSD.ORG, wpaul@FreeBSD.ORG
Subject:   Re: sys/pci/if* fixes
Message-ID:  <Pine.BSF.4.21.0302152224320.43778-100000@root.org>
In-Reply-To: <20030216011126.D73971@sasami.jurai.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, 16 Feb 2003, Matthew N. Dodd wrote:
> On Sat, 15 Feb 2003, Nate Lawson wrote:
> > The 'if' is a matter of coding style.  Which is preferred: multiple
> > returns from the same function (one which is only reachable from a goto)
> > or one linear path with an 'if' to see if this is an error exit?
> 
> In this case a single return is harder to read.

I'm fine with going back to that style if someone else will corroborate
this.  One other advantage to the single return is that if a routine
returns an error but this error is not checked, it will still be caught
with my code whereas attach will return 0 unless code explicitly requests
a failure.  This is not a theoretical bug, many of the calls to
bus_dma_tag_create() did not check for errors returned and would still
return 0.  However, this was never triggered due to that only happening on
a very low memory condition.
 
> > See the previous thread on this regarding my original dc(4) changes.
> > It is bogus to create a lock with mtx_init and then immediately lock it
> > for the entire attach routine just for the intention of ensuring
> > exclusive access to the device.
> 
> The problem is that the drivers aren't properly turning off interrrupts
> before setting up the interrupt handler.

This is on -current, turning off interrupts should be a very rare event.  
On -stable, I plan to only make the bugfixes in place since there is no
locking to deal with.

-Nate


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.21.0302152224320.43778-100000>