[sane-devel] Unused variable (sane-backend/sanei/sanei_pio.c)
Henning Meier-Geinitz
henning at meier-geinitz.de
Sat Dec 1 19:57:22 GMT 2001
Hi,
On Fri, Nov 30, 2001 at 11:43:28PM -0500, Stephen Torri wrote:
> Curious question. Inside sanei_pio.c there is a function called pio_wait.
> Its suppose to return an int if the two boolean comparisons are true. If
> there is nothing at the end of all the polls due to a time out there is no
> int returned.
I don't know nothing about this code. But...
To be exact, the frontend is terminated by exit (-1). This should
never happen, because the frontend has no chance to do correct error
reporting etc. See doc/backend-writing.txt.
> The logic is not complete. We should return an integer in
> both cases if the method is suppose to classed as returning an integer.
> Should we at least be reporting an error. What value would that be?
The -1 isn't too bad. The problem is, that in sanei_pio.c, the result
of pio_wait is never checked, it's just ignored. There should be
something like
if (pio_wait (port, PIO_STAT_BUSY, PIO_STAT_BUSY) < 0)
return -1;
in the functions. In the backends there should be a check for <0 in
this case.
Maybe one of the maintainers of the hp and epson backends which use
sanei_pio.c can comment on this isssue?
Bye,
Henning
More information about the sane-devel
mailing list