diff mbox series

[U-Boot,1/1] fs: fat: avoid superfluous conversion calling set_cluster

Message ID 20180213182329.11684-1-xypron.glpk@gmx.de
State Superseded, archived
Delegated to: Tom Rini
Headers show
Series [U-Boot,1/1] fs: fat: avoid superfluous conversion calling set_cluster | expand

Commit Message

Heinrich Schuchardt Feb. 13, 2018, 6:23 p.m. UTC
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.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
---
 fs/fat/fat_write.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Lukasz Majewski Feb. 13, 2018, 9:27 p.m. UTC | #1
On Tue, 13 Feb 2018 19:23:29 +0100
Heinrich Schuchardt <xypron.glpk@gmx.de> 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.
> 
> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
> ---
>  fs/fat/fat_write.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/fat/fat_write.c b/fs/fat/fat_write.c
> index 2b753df2820..ccc03cecb6e 100644
> --- a/fs/fat/fat_write.c
> +++ b/fs/fat/fat_write.c
> @@ -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;
>  		}

Reviewed-by: Lukasz Majewski <lukma@denx.de>


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@denx.de
diff mbox series

Patch

diff --git a/fs/fat/fat_write.c b/fs/fat/fat_write.c
index 2b753df2820..ccc03cecb6e 100644
--- a/fs/fat/fat_write.c
+++ b/fs/fat/fat_write.c
@@ -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;
 		}