Skip to content

Commit 5a527d8

Browse files
Rafał Miłeckigregkh
authored andcommitted
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>
1 parent 297f55b commit 5a527d8

1 file changed

Lines changed: 4 additions & 6 deletions

File tree

drivers/mtd/bcm47xxpart.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -225,12 +225,10 @@ static int bcm47xxpart_parse(struct mtd_info *master,
225225

226226
last_trx_part = curr_part - 1;
227227

228-
/*
229-
* We have whole TRX scanned, skip to the next part. Use
230-
* roundown (not roundup), as the loop will increase
231-
* offset in next step.
232-
*/
233-
offset = rounddown(offset + trx->length, blocksize);
228+
/* Jump to the end of TRX */
229+
offset = roundup(offset + trx->length, blocksize);
230+
/* Next loop iteration will increase the offset */
231+
offset -= blocksize;
234232
continue;
235233
}
236234

0 commit comments

Comments
 (0)