On 02/13/2018 10:50 PM, Tuomas Tynkkynen wrote:
Hi,

On Tue, 13 Feb 2018 19:18:58 +0100
Heinrich Schuchardt <xypron.g...@gmx.de> 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.

Signed-off-by: Heinrich Schuchardt <xypron.g...@gmx.de>
---
  fs/fat/fat.c | 8 +++++---
  1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/fs/fat/fat.c b/fs/fat/fat.c
index dd7888cd6d4..a3c7bf604eb 100644
--- a/fs/fat/fat.c
+++ b/fs/fat/fat.c
@@ -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) {
+                               (unsigned long)actsize) != 0) {
                        printf("Error reading cluster\n");

If the type is unsigned long, the explicit cast here seems redundant.

actsize is of type l_off_t. As long as loff_t does not have more bits than unsigned long you are right. But the C language does not require this to hold true.

But why shouldn't we use the same type loff_t in the interface of get_cluster. I will update the patch.

Best regards

Heinrich
_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot

Reply via email to