[U-Boot] [PATCH 04/13] sparse: Simplify multiple logic

Maxime Ripard maxime.ripard at free-electrons.com
Mon Aug 31 16:46:04 CEST 2015


To check the alignment of the image blocks to the storage blocks, the
current code uses a convoluted syntax, while a simple mod also does the
work.

Signed-off-by: Maxime Ripard <maxime.ripard at free-electrons.com>
---
 common/aboot.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/common/aboot.c b/common/aboot.c
index 65e633acfcb9..c8556d9b23f4 100644
--- a/common/aboot.c
+++ b/common/aboot.c
@@ -269,8 +269,7 @@ void write_sparse_image(block_dev_desc_t *dev_desc,
 	}
 
 	/* verify sparse_header->blk_sz is an exact multiple of info->blksz */
-	if (sparse_header->blk_sz !=
-	    (sparse_header->blk_sz & ~(info->blksz - 1))) {
+	if (sparse_header->blk_sz % info->blksz) {
 		printf("%s: Sparse image block size issue [%u]\n",
 		       __func__, sparse_header->blk_sz);
 		fastboot_fail("sparse image block size issue");
-- 
2.5.0



More information about the U-Boot mailing list