Re: [PATCH] serial: Z85C30: BCM1480: loops should end at 0

Maciej W. Rozycki
2009-02-10T00:03:54Z

On Sun, 8 Feb 2009, Roel Kluin wrote:

> With a postfix decrement 'loops' reach -1, not 0, which is subsequently
> returned. In drivers/serial/zs.c, line 1137 it is considered as a boolean with 0
> as failure:
>
> if (zs_transmit_drain(zport, irq))
> write_zsdata(zport, ch);
>
> so to use it as such loops should end at 0 after the loop rather than -1.
> This also fix similar issues in other functions.
>
> Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
> ---
> Another solution would be to change the test at drivers/serial/zs.c, line 1137:
>
> if (zs_transmit_drain(zport, irq) == -1)
>
> Is that preferred?

I'm tempted to rewrite these as do {} while loops instead. Thanks for
the report -- I'm running out of disk space on my development system
again, so please allow me a couple of days to make a clean-up before I get
back to your report. The change has to be split into two separate
patches, BTW.

Maciej