U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 1/1] fs: fat: fix link error when building with DEBUG=1
@ 2019-02-25 18:42 Heinrich Schuchardt
  2019-02-28 23:56 ` [U-Boot] [U-Boot, " Tom Rini
  0 siblings, 1 reply; 2+ messages in thread
From: Heinrich Schuchardt @ 2019-02-25 18:42 UTC (permalink / raw)
  To: u-boot

When compiling with DEBUG=1 an error
fs/fat/fat_write.c:831: undefined reference to `__aeabi_ldivmod'
occurred.

We should use do_div() instead of the modulus operator.

filesize and cur_pos cannot be negative. So let's use u64 to avoid
warnings.

Fixes: cb8af8af5ba0 ("fs: fat: support write with non-zero offset")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
---
 fs/fat/fat_write.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/fat/fat_write.c b/fs/fat/fat_write.c
index 3272412ca9..852f874e58 100644
--- a/fs/fat/fat_write.c
+++ b/fs/fat/fat_write.c
@@ -696,11 +696,11 @@ static int
 set_contents(fsdata *mydata, dir_entry *dentptr, loff_t pos, __u8 *buffer,
 	     loff_t maxsize, loff_t *gotsize)
 {
-	loff_t filesize;
 	unsigned int bytesperclust = mydata->clust_size * mydata->sect_size;
 	__u32 curclust = START(dentptr);
 	__u32 endclust = 0, newclust = 0;
-	loff_t cur_pos, offset, actsize, wsize;
+	u64 cur_pos, filesize;
+	loff_t offset, actsize, wsize;
 
 	*gotsize = 0;
 	filesize = pos + maxsize;
@@ -828,7 +828,7 @@ set_contents(fsdata *mydata, dir_entry *dentptr, loff_t pos, __u8 *buffer,
 
 	curclust = endclust;
 	filesize -= cur_pos;
-	assert(!(cur_pos % bytesperclust));
+	assert(!do_div(cur_pos, bytesperclust));
 
 set_clusters:
 	/* allocate and write */
-- 
2.20.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [U-Boot] [U-Boot, 1/1] fs: fat: fix link error when building with DEBUG=1
  2019-02-25 18:42 [U-Boot] [PATCH 1/1] fs: fat: fix link error when building with DEBUG=1 Heinrich Schuchardt
@ 2019-02-28 23:56 ` Tom Rini
  0 siblings, 0 replies; 2+ messages in thread
From: Tom Rini @ 2019-02-28 23:56 UTC (permalink / raw)
  To: u-boot

On Mon, Feb 25, 2019 at 07:42:48PM +0100, Heinrich Schuchardt wrote:

> When compiling with DEBUG=1 an error
> fs/fat/fat_write.c:831: undefined reference to `__aeabi_ldivmod'
> occurred.
> 
> We should use do_div() instead of the modulus operator.
> 
> filesize and cur_pos cannot be negative. So let's use u64 to avoid
> warnings.
> 
> Fixes: cb8af8af5ba0 ("fs: fat: support write with non-zero offset")
> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190228/cd9e3dd5/attachment.sig>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-02-28 23:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-02-25 18:42 [U-Boot] [PATCH 1/1] fs: fat: fix link error when building with DEBUG=1 Heinrich Schuchardt
2019-02-28 23:56 ` [U-Boot] [U-Boot, " Tom Rini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox