Skip to contentSkip to conversation

fs: fat: avoid superfluous conversion calling set_cluster

PATCH Superseded Heinrich Schuchardt 2 participants 2 messages Feb 13, 2018 VFAT/FAT/msdos filesystem

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fs: fat: avoid superfluous conversion calling set_cluster

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.

---
 fs/fat/fat_write.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
fs/fat/fat_write.c +4 -2
index 2b753df2820..ccc03cecb6e 100644
@@ -679,7 +679,8 @@ 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,
+				(unsigned long)actsize) != 0) {
 			debug("error: writing cluster\n");
 			return -1;
 		}
@@ -696,7 +697,8 @@ 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,
+				(unsigned long)actsize) != 0) {
 			debug("error: writing cluster\n");
 			return -1;
 		}
Signature · 1 line
2.14.2
#1 lore raw

PATCH 1/1 fs: fat: avoid superfluous conversion calling set_cluster

Quoted 34 lines · On Tue, 13 Feb 2018 19:23:29 +0100 Heinrich Schuchardt <[email protected]>…

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.

---
 fs/fat/fat_write.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
fs/fat/fat_write.c +2 -1
index 2b753df2820..ccc03cecb6e 100644
@@ -679,7 +679,8 @@ 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,
+				(unsigned long)actsize) != 0) {
 			debug("error: writing cluster\n");
 			return -1;
fs/fat/fat_write.c +2 -1
 		}
@@ -696,7 +697,8 @@ 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,
+				(unsigned long)actsize) != 0) {
 			debug("error: writing cluster\n");
 			return -1;
Quoted 1 line

}

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de -------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180213/f0b0a619/attachment.sig>