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

From: Maciej W. Rozycki
Date: Mon Feb 09 2009 - 19:03:54 EST


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@xxxxxxxxx>
> ---
> 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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/