From owner-freebsd-current Sun Dec 5 11:42:38 1999 Delivered-To: freebsd-current@freebsd.org Received: from mailman.zeta.org.au (mailman.zeta.org.au [203.26.10.16]) by hub.freebsd.org (Postfix) with ESMTP id 680D8153C8; Sun, 5 Dec 1999 11:42:30 -0800 (PST) (envelope-from bde@zeta.org.au) Received: from bde.zeta.org.au (beefcake.zeta.org.au [203.26.10.12]) by mailman.zeta.org.au (8.8.7/8.8.7) with ESMTP id GAA11261; Mon, 6 Dec 1999 06:47:24 +1100 Date: Mon, 6 Dec 1999 06:42:09 +1100 (EST) From: Bruce Evans X-Sender: bde@alphplex.bde.org To: Nick Hibma Cc: FreeBSD CURRENT Mailing List , bde@FreeBSD.ORG, Warner Losh Subject: Re: bug in sio.c sioattach? In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Sun, 5 Dec 1999, Nick Hibma wrote: > In sioattach the returned values kind of look odd to me. I think it > should be different, like below, ENXIO on error, 0 on success. sioattach() was once an old-isa attach routine. Old-isa attach routines return 1 on success and 0 on failure. Some probably don't, because the return value is always ignored :-(. sioattach is still too much like an old-isa attach routine :-). Someone changed the main return (1) to return (0), but not the internal one. > Index: sys/isa/sio.c > =================================================================== > RCS file: /home/ncvs/src/sys/isa/sio.c,v > retrieving revision 1.276 > diff -u -w -r1.276 sio.c > --- sio.c 1999/12/01 07:38:52 1.276 > +++ sio.c 1999/12/05 18:51:10 > @@ -991,7 +991,7 @@ > if (siosetwater(com, com->it_in.c_ispeed) != 0) { > enable_intr(); > free(com, M_DEVBUF); > - return (0); > + return (ENXIO); > } > enable_intr(); > termioschars(&com->it_in); Resource deallocation is also missing here. I doubt that this return has ever been executed; it only occurs if malloc() fails. Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message