Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 6 Dec 1999 06:42:09 +1100 (EST)
From:      Bruce Evans <bde@zeta.org.au>
To:        Nick Hibma <hibma@skylink.it>
Cc:        FreeBSD CURRENT Mailing List <current@FreeBSD.ORG>, bde@FreeBSD.ORG, Warner Losh <imp@village.org>
Subject:   Re: bug in sio.c sioattach?
Message-ID:  <Pine.BSF.4.10.9912060631080.2359-100000@alphplex.bde.org>
In-Reply-To: <Pine.BSF.4.20.9912051951230.492-100000@henny.jrc.it>

next in thread | previous in thread | raw e-mail | index | archive | help
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




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