On Mon, Mar 20, 2000 at 02:59:30PM -0800, Randy Dunlap wrote:
> In usb/printer.c:usblp_write(), it says:
> 
>               if (!usblp->writeurb.status) {
>                       writecount += usblp->writeurb.transfer_buffer_length;
>                       usblp->writeurb.transfer_buffer_length = 0;
>               } else {
> 1:                    if (!(retval = usblp_check_status(usblp))) {
>                               err("usblp%d: error %d writing to printer",
>                                       usblp->minor, usblp->writeurb.status);
> 2:                            return -EIO;
>                       }
> 
>                       return retval;
>               }
> 
> Again, it looks to me like 1: is negated but shouldn't be.  It
> currently says (paraphrased): if (usblp_check_status() == 0)
> Shouldn't it say:             if (usblp_check_status() != 0) ???
> 
> And on 2:, to be compatible with char/lp.c, shouldn't/couldn't this
> return retval instead of -EIO?
> 
> It would help if I had a USB printer, eh?  Sorry if this is all wrong.

If you look at the code closer, you'll see that it'll return 'retval',
the same like lp.c would in case there is any problem reported by the
printer.

However, if the printer doesn't report any error in usblp_check_status,
which then == 0, the driver shouts the error mesage, because something
bad must be happening, and returns the most reasonable error value it
can, the -EIO.

-- 
Vojtech Pavlik
SuSE Labs

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to