mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH 2/2] scripts: imx imx-usb-loader: Fix last transfer error message
Date: Tue, 26 Sep 2017 09:23:51 +0200	[thread overview]
Message-ID: <20170926072351.23040-2-s.hauer@pengutronix.de> (raw)
In-Reply-To: <20170926072351.23040-1-s.hauer@pengutronix.de>

When doing memory read transfers there will always be 64 bytes
transferred, even when less bytes are requested. This is expected
and there is a test skipping the error message in this case. The
test is wrong though since cnt is not decremented and will never
be equal to rem. Fix the test so that verifying memory does
not give a bogus error message.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 scripts/imx/imx-usb-loader.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/imx/imx-usb-loader.c b/scripts/imx/imx-usb-loader.c
index 499e8c8ec6..6052343e00 100644
--- a/scripts/imx/imx-usb-loader.c
+++ b/scripts/imx/imx-usb-loader.c
@@ -635,7 +635,7 @@ static int read_memory(unsigned addr, void *dest, unsigned cnt)
 			break;
 		}
 		if ((last_trans > rem) || (last_trans > 64)) {
-			if ((last_trans == 64) && (cnt == rem)) {
+			if ((last_trans == 64) && (rem < 64)) {
 				/* Last transfer is expected to be too large for HID */
 			} else {
 				printf("err: %02x %02x %02x %02x cnt=%u rem=%d last_trans=%i\n",
-- 
2.11.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

      reply	other threads:[~2017-09-26  7:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-26  7:23 [PATCH 1/2] scripts: imx imx-usb-loader: Add support for i.MX6ull Sascha Hauer
2017-09-26  7:23 ` Sascha Hauer [this message]

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=20170926072351.23040-2-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@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