[PATCH] fs/squashfs: use do_div function for math
Tom Rini
trini at konsulko.com
Thu May 5 15:15:00 CEST 2022
On Thu, May 05, 2022 at 11:26:37AM +0200, Sean Nyekjaer wrote:
> From: Sean Nyekjaer <sean.nyekjaer.ext at siemensgamesa.com>
>
> When compling for x86:
> ld.bfd: fs/squashfs/sqfs.o: in function `sqfs_read':
> u-boot/fs/squashfs/sqfs.c:1443: undefined reference to `__udivmoddi4'
> ld.bfd: u-boot/fs/squashfs/sqfs.c:1521: undefined reference to `__udivmoddi4'
>
> Signed-off-by: Sean Nyekjaer <sean.nyekjaer.ext at siemensgamesa.com>
> ---
> fs/squashfs/sqfs.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/fs/squashfs/sqfs.c b/fs/squashfs/sqfs.c
> index 5d9c52af80..6405db4ff3 100644
> --- a/fs/squashfs/sqfs.c
> +++ b/fs/squashfs/sqfs.c
> @@ -8,6 +8,7 @@
> */
>
> #include <asm/unaligned.h>
> +#include <div64.h>
> #include <errno.h>
> #include <fs.h>
> #include <linux/types.h>
> @@ -1440,7 +1441,7 @@ int sqfs_read(const char *filename, void *buf, loff_t offset, loff_t len,
> }
>
> for (j = 0; j < datablk_count; j++) {
> - start = data_offset / ctxt.cur_dev->blksz;
> + start = do_div(data_offset, ctxt.cur_dev->blksz);
> table_size = SQFS_BLOCK_SIZE(finfo.blk_sizes[j]);
> table_offset = data_offset - (start * ctxt.cur_dev->blksz);
> n_blks = DIV_ROUND_UP(table_size + table_offset,
> @@ -1516,7 +1517,7 @@ int sqfs_read(const char *filename, void *buf, loff_t offset, loff_t len,
> goto out;
> }
>
> - start = frag_entry.start / ctxt.cur_dev->blksz;
> + start = do_div(frag_entry.start, ctxt.cur_dev->blksz);
> table_size = SQFS_BLOCK_SIZE(frag_entry.size);
> table_offset = frag_entry.start - (start * ctxt.cur_dev->blksz);
> n_blks = DIV_ROUND_UP(table_size + table_offset, ctxt.cur_dev->blksz);
Adding maintainers...
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20220505/ce1d3e56/attachment.sig>
More information about the U-Boot
mailing list