From: Shimoda, Yoshihiro Date: Tue, 27 Aug 2013 02:15:09 +0000 (+0900) Subject: spi: spi-rspi: fix inconsistent spin_lock_irqsave X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=8d4d08ce8319ae26227c4dd558405963c14c2037;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git spi: spi-rspi: fix inconsistent spin_lock_irqsave This patch fixes the following Smatch warning: CHECK drivers/spi/spi-rspi.c drivers/spi/spi-rspi.c:606 rspi_work() warn: inconsistent returns spin_lock:&rspi->lock: locked (602) unlocked (606) drivers/spi/spi-rspi.c:606 rspi_work() warn: inconsistent returns irqsave:flags: locked (602) unlocked (606) Reported-by: Dan Carpenter Signed-off-by: Yoshihiro Shimoda Signed-off-by: Mark Brown --- diff --git a/drivers/spi/spi-rspi.c b/drivers/spi/spi-rspi.c index 5f122d9d2063..00c32320dce8 100644 --- a/drivers/spi/spi-rspi.c +++ b/drivers/spi/spi-rspi.c @@ -564,8 +564,12 @@ static void rspi_work(struct work_struct *work) unsigned long flags; int ret; - spin_lock_irqsave(&rspi->lock, flags); - while (!list_empty(&rspi->queue)) { + while (1) { + spin_lock_irqsave(&rspi->lock, flags); + if (list_empty(&rspi->queue)) { + spin_unlock_irqrestore(&rspi->lock, flags); + break; + } mesg = list_entry(rspi->queue.next, struct spi_message, queue); list_del_init(&mesg->queue); spin_unlock_irqrestore(&rspi->lock, flags); @@ -595,8 +599,6 @@ static void rspi_work(struct work_struct *work) mesg->status = 0; mesg->complete(mesg->context); - - spin_lock_irqsave(&rspi->lock, flags); } return;