[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87ve2rqh6u.fsf@saeurebad.de>
Date: Wed, 09 Apr 2008 15:41:13 +0200
From: Johannes Weiner <hannes@...urebad.de>
To: Roel Kluin <12o3l@...cali.nl>
Cc: "Maciej W. Rozycki" <macro@...ux-mips.org>,
lkml <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] dz: test after postfix decrement fails in dz_console_putchar()
Hi,
Roel Kluin <12o3l@...cali.nl> writes:
> When loops reaches 0 the postfix decrement still subtracts, so the test fails
>
> Signed-off-by: Roel Kluin <12o3l@...cali.nl>
> ---
> diff --git a/drivers/serial/dz.c b/drivers/serial/dz.c
> index 116211f..0dddd68 100644
> --- a/drivers/serial/dz.c
> +++ b/drivers/serial/dz.c
> @@ -819,7 +819,7 @@ static void dz_console_putchar(struct uart_port *uport, int ch)
> dz_out(dport, DZ_TCR, mask);
> iob();
> udelay(2);
> - } while (loops--);
> + } while (--loops);
It will run loops + 1 times. After your change it does run loops times.
> if (loops) /* Cannot send otherwise. */
> dz_out(dport, DZ_TDR, ch);
The intention was probably that this gets executed if the break in the
loop (trdy == dport->port.line) is reached. Without your fix, this
branch is also taken if the while-loop terminates with loops == -1
because of the postfix dec.
Your fix is correct but your changelog entry is wrong.
Hannes
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists