Re: Patch: Fix serial module use count (2.4.16 _and_ 2.5)

Jeff Randall
2001-11-29T18:03:55Z

Balbir Singh wrote:
> >Err,
> > close(-ENOMEM);
>
> >What's that going to close? Hint: you _can't_ close
> a descriptor that
> >failed to open, since you don't have a descriptor to
> close. You can
> >only try to close an error code, but that's not going
> to make it anywhere
> >near the kernel driver level.
>
> Let me make it clearer to you,
>
> lets say I call rs_open() on /dev/ttyS0 and if it
> fails then I should not call rs_close() after a failed
> rs_open().
>
> I hope this is clear now.

All of the other UNIX variants I've dealth with behave that way.
However, you cannot just make that change without having some means
of identifying that behavior change because all of the linux
serial drivers have been written to assume that their close()
will be called even after their open() has failed.

I'm not opposed to such a change in behavior, but at least be
sure that it's somehow identifiable (kernel version, a define
set in a header, etc) so that the 3rd party drivers have a means
to identify the change.

Redhat 7.1 included that behavior change in the kernel they shipped
and it caused no end of problems for those of us that were doing
serial drivers since there was no way to easily identify that the
patch had been included.

--
randall+lkml@uph.com