1
0

042-0004-mtd-bcm47xxpart-fix-parsing-first-block-after-aligne.patch 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. From bd5d21310133921021d78995ad6346f908483124 Mon Sep 17 00:00:00 2001
  2. From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
  3. Date: Sun, 20 Nov 2016 16:09:30 +0100
  4. Subject: [PATCH] mtd: bcm47xxpart: fix parsing first block after aligned TRX
  5. MIME-Version: 1.0
  6. Content-Type: text/plain; charset=UTF-8
  7. Content-Transfer-Encoding: 8bit
  8. After parsing TRX we should skip to the first block placed behind it.
  9. Our code was working only with TRX with length not aligned to the
  10. blocksize. In other cases (length aligned) it was missing the block
  11. places right after TRX.
  12. This fixes calculation and simplifies the comment.
  13. Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
  14. Signed-off-by: Brian Norris <computersforpeace@gmail.com>
  15. ---
  16. drivers/mtd/bcm47xxpart.c | 10 ++++------
  17. 1 file changed, 4 insertions(+), 6 deletions(-)
  18. --- a/drivers/mtd/bcm47xxpart.c
  19. +++ b/drivers/mtd/bcm47xxpart.c
  20. @@ -229,12 +229,10 @@ static int bcm47xxpart_parse(struct mtd_
  21. last_trx_part = curr_part - 1;
  22. - /*
  23. - * We have whole TRX scanned, skip to the next part. Use
  24. - * roundown (not roundup), as the loop will increase
  25. - * offset in next step.
  26. - */
  27. - offset = rounddown(offset + trx->length, blocksize);
  28. + /* Jump to the end of TRX */
  29. + offset = roundup(offset + trx->length, blocksize);
  30. + /* Next loop iteration will increase the offset */
  31. + offset -= blocksize;
  32. continue;
  33. }