diff options
author | Rafał Miłecki <rafal@milecki.pl> | 2016-11-20 10:09:30 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-04-18 01:11:47 -0400 |
commit | 760327cb080bc4e0b47503fc0794ef94214a778d (patch) | |
tree | adcc4fea969c2520fcbb7b354eb0c31f6532b7cc | |
parent | 31c576a5fe506b173559cf956dfd7f792cbfd601 (diff) |
mtd: bcm47xxpart: fix parsing first block after aligned TRX
commit bd5d21310133921021d78995ad6346f908483124 upstream.
After parsing TRX we should skip to the first block placed behind it.
Our code was working only with TRX with length not aligned to the
blocksize. In other cases (length aligned) it was missing the block
places right after TRX.
This fixes calculation and simplifies the comment.
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/mtd/bcm47xxpart.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/drivers/mtd/bcm47xxpart.c b/drivers/mtd/bcm47xxpart.c index 377947580203..283ff7e17a0f 100644 --- a/drivers/mtd/bcm47xxpart.c +++ b/drivers/mtd/bcm47xxpart.c | |||
@@ -229,12 +229,10 @@ static int bcm47xxpart_parse(struct mtd_info *master, | |||
229 | 229 | ||
230 | last_trx_part = curr_part - 1; | 230 | last_trx_part = curr_part - 1; |
231 | 231 | ||
232 | /* | 232 | /* Jump to the end of TRX */ |
233 | * We have whole TRX scanned, skip to the next part. Use | 233 | offset = roundup(offset + trx->length, blocksize); |
234 | * roundown (not roundup), as the loop will increase | 234 | /* Next loop iteration will increase the offset */ |
235 | * offset in next step. | 235 | offset -= blocksize; |
236 | */ | ||
237 | offset = rounddown(offset + trx->length, blocksize); | ||
238 | continue; | 236 | continue; |
239 | } | 237 | } |
240 | 238 | ||