[PATCH 2/4] block: shortcut writebuffer_flush if writing is disabled

Sascha Hauer s.hauer at pengutronix.de
Mon Jul 22 05:56:21 EDT 2013


Saves a few bytes of binary space.

Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 common/block.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/common/block.c b/common/block.c
index ad07f8b..ab39a36 100644
--- a/common/block.c
+++ b/common/block.c
@@ -43,6 +43,9 @@ static int writebuffer_flush(struct block_device *blk)
 {
 	struct chunk *chunk;
 
+	if (!IS_ENABLED(CONFIG_BLOCK_WRITE))
+		return 0;
+
 	list_for_each_entry(chunk, &blk->buffered_blocks, list) {
 		if (chunk->dirty) {
 			blk->ops->write(blk, chunk->data, chunk->block_start, blk->rdbufsize);
-- 
1.8.3.2




More information about the barebox mailing list