summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2021-03-15 18:00:15 +1300
committerSimon Glass <sjg@chromium.org>2021-03-27 13:59:37 +1300
commit0e2fee52d0fba6ceb455c7969eecb2cf73031267 (patch)
tree63b4bf415dd5eff22e5525e2c815c7bbb6ea79ab /fs
parent70a394a6b6437e18e67edfd7054302b830e1fe6a (diff)
downloadu-boot-0e2fee52d0fba6ceb455c7969eecb2cf73031267.tar.gz
cbfs: Simplify file iteration
In file_cbfs_next_file() there is a lot of complicated code to move to the next file. Use the ALIGN() macros to simplify this. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/cbfs/cbfs.c7
1 files changed, 1 insertions, 6 deletions
diff --git a/fs/cbfs/cbfs.c b/fs/cbfs/cbfs.c
index a93dc3d0c1..9e534d15f2 100644
--- a/fs/cbfs/cbfs.c
+++ b/fs/cbfs/cbfs.c
@@ -133,7 +133,6 @@ static int file_cbfs_next_file(struct cbfs_priv *priv, void *start, int size,
while (size >= align) {
const struct cbfs_fileheader *file_header = start;
- u32 step;
int ret;
/* Check if there's a file here. */
@@ -152,11 +151,7 @@ static int file_cbfs_next_file(struct cbfs_priv *priv, void *start, int size,
return log_msg_ret("fill", ret);
}
- step = header.len;
- if (step % align)
- step = step + align - step % align;
-
- *used += step;
+ *used += ALIGN(header.len, align);
return 0;
}