From: Tom Rini Date: Fri, 23 Feb 2018 10:40:28 -0500 Subject: [U-Boot] [U-Boot, v2, 1/1] fs: fat: avoid useless conversion when calling get_cluster In-Reply-To: <20180214181728.2006-1-xypron.glpk@gmx.de> References: <20180214181728.2006-1-xypron.glpk@gmx.de> Message-ID: <20180223154028.GB2200@bill-the-cat> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Wed, Feb 14, 2018 at 07:17:28PM +0100, Heinrich Schuchardt wrote: > Parameter size of function get_cluster() is of type unsigned long. It makes > no sense to convert actsize to int before passing it to get_cluster as > size. Let't use t_off as type of parameter to avoid any type conversion. > > Signed-off-by: Heinrich Schuchardt > --- > v2 > change type of parameter size > --- > fs/fat/fat.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/fs/fat/fat.c b/fs/fat/fat.c > index dd7888cd6d4..cf4580b63df 100644 > --- a/fs/fat/fat.c > +++ b/fs/fat/fat.c > @@ -244,7 +244,7 @@ static __u32 get_fatent(fsdata *mydata, __u32 entry) > * Return 0 on success, -1 otherwise. > */ > static int > -get_cluster(fsdata *mydata, __u32 clustnum, __u8 *buffer, unsigned long size) > +get_cluster(fsdata *mydata, __u32 clustnum, __u8 *buffer, loff_t size) > { > __u32 idx = 0; > __u32 startsect; > @@ -353,7 +353,7 @@ static int get_contents(fsdata *mydata, dir_entry *dentptr, loff_t pos, > if (pos) { > actsize = min(filesize, (loff_t)bytesperclust); > if (get_cluster(mydata, curclust, get_contents_vfatname_block, > - (int)actsize) != 0) { > + actsize) != 0) { > printf("Error reading cluster\n"); > return -1; > } > @@ -393,14 +393,14 @@ static int get_contents(fsdata *mydata, dir_entry *dentptr, loff_t pos, > > /* get remaining bytes */ > actsize = filesize; > - if (get_cluster(mydata, curclust, buffer, (int)actsize) != 0) { > + if (get_cluster(mydata, curclust, buffer, actsize) != 0) { > printf("Error reading cluster\n"); > return -1; > } > *gotsize += actsize; > return 0; > getit: > - if (get_cluster(mydata, curclust, buffer, (int)actsize) != 0) { > + if (get_cluster(mydata, curclust, buffer, actsize) != 0) { > printf("Error reading cluster\n"); > return -1; > } And similar to my last message, this also causes problems on for example socfpga_sr1500. -- Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: not available URL: