summaryrefslogtreecommitdiffstats
path: root/common/block.c
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2013-07-19 11:58:43 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2013-07-22 11:49:01 +0200
commitc7848ffee2646d55efe05c2df5b2d04b47dd9384 (patch)
tree02393ad7c7c651fdab980e53e95599c83a7943e3 /common/block.c
parent8c41c54da805eeae14e9d9d1cce58f49bcb9ecb6 (diff)
downloadbarebox-c7848ffee2646d55efe05c2df5b2d04b47dd9384.tar.gz
block: shortcut writebuffer_flush if writing is disabled
Saves a few bytes of binary space. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common/block.c')
-rw-r--r--common/block.c3
1 files changed, 3 insertions, 0 deletions
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);