Re: pxa2xx_spi: spi_bfin5xx: limit reaches -1 rather than 0

roel kluin
2009-02-08T16:59:22Z

2009/2/8 David Brownell <david-b@pacbell.net>:
> On Sunday 08 February 2009, Roel Kluin wrote:
>> vi drivers/spi/pxa2xx_spi.c +919
>> vi drivers/spi/spi_bfin5xx.c +645
>>
>> if (flush(drv_data) == 0) {
>> dev_err(&drv_data->pdev->dev, "pump_transfers: flush failed\n");
>> message->status = -EIO;
>> giveback(drv_data);
>> return;
>> }
>>
>> But with a postfix decrement limit reaches -1 rather than 0.
>>
>> Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
>
> Acked-by: David Brownell <dbrownell@users.sourceforge.net>

could you please review the patch at http://lkml.org/lkml/2009/2/8/72
instead? I initially overlooked two similar issues in the same file.

> Although, note that if the *actual* count mattered here,
> the correect patch would be to test "flush() < 0)" ...
> except when using a "do {...} while (--limit)" idiom.

True. You can also increase the limit with 1 when changing post- to
prefix for the while (--limit) {...} idiom.