* [U-Boot] [PATCH v2 1/1] fs: fat: avoid superfluous conversion calling set_cluster
@ 2018-02-14 18:14 Heinrich Schuchardt
2018-02-23 15:40 ` [U-Boot] [U-Boot, v2, " Tom Rini
0 siblings, 1 reply; 2+ messages in thread
From: Heinrich Schuchardt @ 2018-02-14 18:14 UTC (permalink / raw)
To: u-boot
Parameter size of function set_cluster is of type unsigned long. It makes
no sense to convert actsize to int before passing it to set_cluster as
size. Let's use loff_t as type of parameter size to avoid any conversion.
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
---
v2
change type of parameter size
---
fs/fat/fat_write.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/fs/fat/fat_write.c b/fs/fat/fat_write.c
index 2b753df2820..270b2908acd 100644
--- a/fs/fat/fat_write.c
+++ b/fs/fat/fat_write.c
@@ -494,8 +494,7 @@ static __u32 determine_fatent(fsdata *mydata, __u32 entry)
* Return 0 on success, -1 otherwise.
*/
static int
-set_cluster(fsdata *mydata, __u32 clustnum, __u8 *buffer,
- unsigned long size)
+set_cluster(fsdata *mydata, __u32 clustnum, __u8 *buffer, loff_t size)
{
__u32 idx = 0;
__u32 startsect;
@@ -679,7 +678,7 @@ set_contents(fsdata *mydata, dir_entry *dentptr, __u8 *buffer,
/* set remaining bytes */
actsize = filesize;
- if (set_cluster(mydata, curclust, buffer, (int)actsize) != 0) {
+ if (set_cluster(mydata, curclust, buffer, actsize) != 0) {
debug("error: writing cluster\n");
return -1;
}
@@ -696,7 +695,7 @@ set_contents(fsdata *mydata, dir_entry *dentptr, __u8 *buffer,
return 0;
getit:
- if (set_cluster(mydata, curclust, buffer, (int)actsize) != 0) {
+ if (set_cluster(mydata, curclust, buffer, actsize) != 0) {
debug("error: writing cluster\n");
return -1;
}
--
2.11.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [U-Boot] [U-Boot, v2, 1/1] fs: fat: avoid superfluous conversion calling set_cluster
2018-02-14 18:14 [U-Boot] [PATCH v2 1/1] fs: fat: avoid superfluous conversion calling set_cluster Heinrich Schuchardt
@ 2018-02-23 15:40 ` Tom Rini
0 siblings, 0 replies; 2+ messages in thread
From: Tom Rini @ 2018-02-23 15:40 UTC (permalink / raw)
To: u-boot
On Wed, Feb 14, 2018 at 07:14:43PM +0100, Heinrich Schuchardt wrote:
> Parameter size of function set_cluster is of type unsigned long. It makes
> no sense to convert actsize to int before passing it to set_cluster as
> size. Let's use loff_t as type of parameter size to avoid any conversion.
>
> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
> ---
> v2
> change type of parameter size
> ---
> fs/fat/fat_write.c | 7 +++----
> 1 file changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/fs/fat/fat_write.c b/fs/fat/fat_write.c
> index 2b753df2820..270b2908acd 100644
> --- a/fs/fat/fat_write.c
> +++ b/fs/fat/fat_write.c
> @@ -494,8 +494,7 @@ static __u32 determine_fatent(fsdata *mydata, __u32 entry)
> * Return 0 on success, -1 otherwise.
> */
> static int
> -set_cluster(fsdata *mydata, __u32 clustnum, __u8 *buffer,
> - unsigned long size)
> +set_cluster(fsdata *mydata, __u32 clustnum, __u8 *buffer, loff_t size)
> {
> __u32 idx = 0;
> __u32 startsect;
> @@ -679,7 +678,7 @@ set_contents(fsdata *mydata, dir_entry *dentptr, __u8 *buffer,
>
> /* set remaining bytes */
> actsize = filesize;
> - if (set_cluster(mydata, curclust, buffer, (int)actsize) != 0) {
> + if (set_cluster(mydata, curclust, buffer, actsize) != 0) {
> debug("error: writing cluster\n");
> return -1;
> }
> @@ -696,7 +695,7 @@ set_contents(fsdata *mydata, dir_entry *dentptr, __u8 *buffer,
>
> return 0;
> getit:
> - if (set_cluster(mydata, curclust, buffer, (int)actsize) != 0) {
> + if (set_cluster(mydata, curclust, buffer, actsize) != 0) {
> debug("error: writing cluster\n");
> return -1;
> }
So, this introduces a bunch of build issues when using certain
toolchains (such as Debian's arm-linux-gnueabihf):
arm: + display5
+(display5) fs/built-in.o: In function `get_cluster':
+(display5) build/../fs/fat/fat.c:278: undefined reference to `__aeabi_ldivmod'
+(display5) arm-linux-gnueabihf-ld.bfd: BFD (GNU Binutils for Debian) 2.28 assertion fail ../../bfd/elf32-arm.c:9514
+(display5) make[1]: *** [u-boot] Error 1
+(display5) make: *** [sub-make] Error 2
--
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/20180223/5a48afc8/attachment.sig>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-02-23 15:40 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-14 18:14 [U-Boot] [PATCH v2 1/1] fs: fat: avoid superfluous conversion calling set_cluster Heinrich Schuchardt
2018-02-23 15:40 ` [U-Boot] [U-Boot, v2, " Tom Rini
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.