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 [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message