From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Brownell Subject: Re: [PATCH] spi_bfin5xx: limit reaches -1 Date: Thu, 16 Apr 2009 16:12:48 -0700 Message-ID: <200904161612.49014.david-b@pacbell.net> References: <49E7A528.9070400@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: Bryan Wu , spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org, Andrew Morton To: Roel Kluin Return-path: In-Reply-To: <49E7A528.9070400-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> Content-Disposition: inline List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: spi-devel-general-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org List-Id: linux-spi.vger.kernel.org On Thursday 16 April 2009, Roel Kluin wrote: > bfin_spi_flush() returns limit, which reaches -1 upon timeout. but in function > bfin_spi_pump_transfers() it is compared with 0. > > Signed-off-by: Roel Kluin Acked-by: David Brownell ... although this could trigger a rarely-seen-before fault path in this driver, which I hope won't cause trouble. Bryan? > --- > diff --git a/drivers/spi/spi_bfin5xx.c b/drivers/spi/spi_bfin5xx.c > index f014cc2..6545b0c 100644 > --- a/drivers/spi/spi_bfin5xx.c > +++ b/drivers/spi/spi_bfin5xx.c > @@ -169,7 +169,7 @@ static int bfin_spi_flush(struct driver_data *drv_data) > unsigned long limit = loops_per_jiffy << 1; > > /* wait for stop and clear stat */ > - while (!(read_STAT(drv_data) & BIT_STAT_SPIF) && limit--) > + while (!(read_STAT(drv_data) & BIT_STAT_SPIF) && --limit) > cpu_relax(); > > write_STAT(drv_data, BIT_STAT_CLR); > > ------------------------------------------------------------------------------ Stay on top of everything new and different, both inside and around Java (TM) technology - register by April 22, and save $200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco. 300 plus technical and hands-on sessions. Register today. Use priority code J9JMT32. http://p.sf.net/sfu/p