linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: marex@denx.de (Marek Vasut)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/4] mxs/spi: Increment the transfer length only if transfer succeeded
Date: Tue,  4 Sep 2012 04:40:16 +0200	[thread overview]
Message-ID: <1346726418-2856-3-git-send-email-marex@denx.de> (raw)
In-Reply-To: <1346726418-2856-1-git-send-email-marex@denx.de>

The transfer function incremented (struct spi_message)->actual_length
unconditionally, even if the transfer failed. Rectify this by incrementing
this only if transfer succeeded.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Chris Ball <cjb@laptop.org>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Grant Likely <grant.likely@secretlab.ca>
Cc: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: Shawn Guo <shawn.guo@linaro.org>
---
 drivers/spi/spi-mxs.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/spi/spi-mxs.c b/drivers/spi/spi-mxs.c
index 3add52e..282bdd7 100644
--- a/drivers/spi/spi-mxs.c
+++ b/drivers/spi/spi-mxs.c
@@ -473,12 +473,12 @@ static int mxs_spi_transfer_one(struct spi_master *master,
 						&first, &last, 0);
 		}
 
-		m->actual_length += t->len;
 		if (status) {
 			stmp_reset_block(ssp->base);
 			break;
 		}
 
+		m->actual_length += t->len;
 		first = last = 0;
 	}
 
-- 
1.7.10.4

  parent reply	other threads:[~2012-09-04  2:40 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-04  2:40 [PATCH 0/4] mxs/spi: Fixes and improvements Marek Vasut
2012-09-04  2:40 ` [PATCH 1/4] mxs/spi: Fix issues when doing long continuous transfer Marek Vasut
2012-09-04  2:40 ` Marek Vasut [this message]
2012-09-04  2:40 ` [PATCH 3/4] mxs/spi: Decrement the DMA/PIO border Marek Vasut
2012-09-04  2:40 ` [PATCH 4/4] mxs/spi: Rework the mxs_ssp_timeout to be more readable Marek Vasut
2012-09-05 23:42 ` [PATCH 0/4] mxs/spi: Fixes and improvements Mark Brown
2012-09-06  2:05   ` Marek Vasut

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1346726418-2856-3-git-send-email-marex@denx.de \
    --to=marex@denx.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).