[U-Boot] [PATCH 0/6] YAFFS2: fix build warnings

The following set of patches fixes the build warnings from the YAFFS2 code in a minimal-invasive way. No attempts are made to fix the coding style (imported from Linux), so the patches are not checkpatch clean. A more thorough clean up is probably a waste of efforts - instead, the code should be updated to a more recent version.
Wolfgang Denk (6): YAFFS2: cmd_yaffs2.c - fix build warnings YAFFS2: fs/yaffs2/yaffscfg.c - fix build warnings YAFFS2: fs/yaffs2/Makefile - fix build warnings YAFFS2: fs/yaffs2/yaffs_nand.[hc] - fix build warnings YAFFS2: fs/yaffs2/yaffs_guts.c - fix build warnings YAFFS2: fs/yaffs2/yaffs_guts.c - fix build warnings
common/cmd_yaffs2.c | 2 +- fs/yaffs2/Makefile | 2 +- fs/yaffs2/yaffs_guts.c | 25 +++++++++++++------------ fs/yaffs2/yaffs_nand.c | 2 +- fs/yaffs2/yaffs_nand.h | 2 +- fs/yaffs2/yaffscfg.c | 4 ++-- 6 files changed, 19 insertions(+), 18 deletions(-)

Fix these: cmd_yaffs2.c: In function 'do_ywr': cmd_yaffs2.c:69: warning: format '%x' expects type 'unsigned int', but argument 2 has type 'ulong' cmd_yaffs2.c:69: warning: format '%x' expects type 'unsigned int', but argument 3 has type 'ulong'
Signed-off-by: Wolfgang Denk wd@denx.de --- common/cmd_yaffs2.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/common/cmd_yaffs2.c b/common/cmd_yaffs2.c index 7c01ea2..0e22d90 100644 --- a/common/cmd_yaffs2.c +++ b/common/cmd_yaffs2.c @@ -66,7 +66,7 @@ int do_ywr (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) ulong value = simple_strtoul(argv[2], NULL, 16); ulong numValues = simple_strtoul(argv[3], NULL, 16);
- printf ("Writing value (%x) %x times to %s... ", value, numValues, filename); + printf ("Writing value (%lx) %lx times to %s... ", value, numValues, filename);
cmd_yaffs_write_file(filename,value,numValues);

Dear Wolfgang Denk,
In message 1315483822-25399-2-git-send-email-wd@denx.de you wrote:
Fix these: cmd_yaffs2.c: In function 'do_ywr': cmd_yaffs2.c:69: warning: format '%x' expects type 'unsigned int', but argument 2 has type 'ulong' cmd_yaffs2.c:69: warning: format '%x' expects type 'unsigned int', but argument 3 has type 'ulong'
Signed-off-by: Wolfgang Denk wd@denx.de
common/cmd_yaffs2.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
Applied, thanks.
Best regards,
Wolfgang Denk

Fix these: yaffscfg.c: In function 'cmd_yaffs_mread_file': yaffscfg.c:316: warning: format '%08x' expects type 'unsigned int', but argument 3 has type 'char *' yaffscfg.c: In function 'cmd_yaffs_ls': yaffscfg.c:371: warning: format '%7d' expects type 'int', but argument 3 has type 'off_t'
Signed-off-by: Wolfgang Denk wd@denx.de --- fs/yaffs2/yaffscfg.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/yaffs2/yaffscfg.c b/fs/yaffs2/yaffscfg.c index 16e84a4..01399ea 100644 --- a/fs/yaffs2/yaffscfg.c +++ b/fs/yaffs2/yaffscfg.c @@ -313,7 +313,7 @@ void cmd_yaffs_mread_file(char *fn, char *addr)
yaffs_stat(fn,&s);
- printf ("Copy %s to 0x%08x... ", fn, addr); + printf ("Copy %s to 0x%p... ", fn, addr); h = yaffs_open(fn, O_RDWR,0); if(h<0) { @@ -368,7 +368,7 @@ void cmd_yaffs_ls(const char *mountpt, int longlist) { sprintf(tempstr, "%s/%s", mountpt, de->d_name); yaffs_stat(tempstr, &stat); - printf("%-25s\t%7d\n",de->d_name, stat.st_size); + printf("%-25s\t%7ld\n",de->d_name, stat.st_size); } else {

Dear Wolfgang Denk,
In message 1315483822-25399-3-git-send-email-wd@denx.de you wrote:
Fix these: yaffscfg.c: In function 'cmd_yaffs_mread_file': yaffscfg.c:316: warning: format '%08x' expects type 'unsigned int', but argument 3 has type 'char *' yaffscfg.c: In function 'cmd_yaffs_ls': yaffscfg.c:371: warning: format '%7d' expects type 'int', but argument 3 has type 'off_t'
Signed-off-by: Wolfgang Denk wd@denx.de
fs/yaffs2/yaffscfg.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
Applied, thanks.
Best regards,
Wolfgang Denk

Drop the "-DNO_Y_INLINE" setting to fix these: yaffs_guts.h:806: warning: 'yaffs_GetBlockInfo' defined but not used
Impact on image size is negligible - for the VCMA9 board the text segment size grew from 496353 to 496357 bytes (i. e. 0.0008%); total image size even remained constant.
Signed-off-by: Wolfgang Denk wd@denx.de --- fs/yaffs2/Makefile | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/fs/yaffs2/Makefile b/fs/yaffs2/Makefile index 7753cfc..6c50c81 100644 --- a/fs/yaffs2/Makefile +++ b/fs/yaffs2/Makefile @@ -31,7 +31,7 @@ SRCS := $(COBJS-y:.o=.c) OBJS := $(addprefix $(obj),$(COBJS-y))
# -DCONFIG_YAFFS_NO_YAFFS1 -CFLAGS += -DCONFIG_YAFFS_DIRECT -DCONFIG_YAFFS_SHORT_NAMES_IN_RAM -DCONFIG_YAFFS_YAFFS2 -DNO_Y_INLINE -DLINUX_VERSION_CODE=0x20622 +CFLAGS += -DCONFIG_YAFFS_DIRECT -DCONFIG_YAFFS_SHORT_NAMES_IN_RAM -DCONFIG_YAFFS_YAFFS2 -DLINUX_VERSION_CODE=0x20622
all: $(LIB)

Dear Wolfgang Denk,
In message 1315483822-25399-4-git-send-email-wd@denx.de you wrote:
Drop the "-DNO_Y_INLINE" setting to fix these: yaffs_guts.h:806: warning: 'yaffs_GetBlockInfo' defined but not used
Impact on image size is negligible - for the VCMA9 board the text segment size grew from 496353 to 496357 bytes (i. e. 0.0008%); total image size even remained constant.
Signed-off-by: Wolfgang Denk wd@denx.de
fs/yaffs2/Makefile | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
Applied, thanks.
Best regards,
Wolfgang Denk

Fix these: yaffs_guts.c: In function 'yaffs_Scan': yaffs_guts.c:5436: warning: pointer targets in passing argument 4 of 'yaffs_QueryInitialBlockState' differ in signedness yaffs_guts.c: In function 'yaffs_ScanBackwards': yaffs_guts.c:6017: warning: pointer targets in passing argument 4 of 'yaffs_QueryInitialBlockState' differ in signedness yaffs_nand.c: In function 'yaffs_QueryInitialBlockState': yaffs_nand.c:109: warning: pointer targets in passing argument 4 of 'dev->queryNANDBlock' differ in signedness yaffs_nand.c:113: warning: pointer targets in passing argument 4 of 'yaffs_TagsCompatabilityQueryNANDBlock' differ in signedness
Signed-off-by: Wolfgang Denk wd@denx.de --- fs/yaffs2/yaffs_nand.c | 2 +- fs/yaffs2/yaffs_nand.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/yaffs2/yaffs_nand.c b/fs/yaffs2/yaffs_nand.c index e790be6..ce048cc 100644 --- a/fs/yaffs2/yaffs_nand.c +++ b/fs/yaffs2/yaffs_nand.c @@ -101,7 +101,7 @@ int yaffs_MarkBlockBad(yaffs_Device * dev, int blockNo) int yaffs_QueryInitialBlockState(yaffs_Device * dev, int blockNo, yaffs_BlockState * state, - unsigned *sequenceNumber) + int *sequenceNumber) { blockNo -= dev->blockOffset;
diff --git a/fs/yaffs2/yaffs_nand.h b/fs/yaffs2/yaffs_nand.h index 48e3f7e..f3bedcf 100644 --- a/fs/yaffs2/yaffs_nand.h +++ b/fs/yaffs2/yaffs_nand.h @@ -33,7 +33,7 @@ int yaffs_MarkBlockBad(yaffs_Device * dev, int blockNo); int yaffs_QueryInitialBlockState(yaffs_Device * dev, int blockNo, yaffs_BlockState * state, - unsigned *sequenceNumber); + int *sequenceNumber);
int yaffs_EraseBlockInNAND(struct yaffs_DeviceStruct *dev, int blockInNAND);

Dear Wolfgang Denk,
In message 1315483822-25399-5-git-send-email-wd@denx.de you wrote:
Fix these: yaffs_guts.c: In function 'yaffs_Scan': yaffs_guts.c:5436: warning: pointer targets in passing argument 4 of 'yaffs_QueryInitialBlockState' differ in signedness yaffs_guts.c: In function 'yaffs_ScanBackwards': yaffs_guts.c:6017: warning: pointer targets in passing argument 4 of 'yaffs_QueryInitialBlockState' differ in signedness yaffs_nand.c: In function 'yaffs_QueryInitialBlockState': yaffs_nand.c:109: warning: pointer targets in passing argument 4 of 'dev->queryNANDBlock' differ in signedness yaffs_nand.c:113: warning: pointer targets in passing argument 4 of 'yaffs_TagsCompatabilityQueryNANDBlock' differ in signedness
Signed-off-by: Wolfgang Denk wd@denx.de
fs/yaffs2/yaffs_nand.c | 2 +- fs/yaffs2/yaffs_nand.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
Applied, thanks.
Best regards,
Wolfgang Denk

Fix these: yaffs_guts.c: At top level: yaffs_guts.c:400: warning: 'yaffs_SkipFullVerification' defined but not used
Testing shows no changes of the image sizes.
Signed-off-by: Wolfgang Denk wd@denx.de --- fs/yaffs2/yaffs_guts.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/fs/yaffs2/yaffs_guts.c b/fs/yaffs2/yaffs_guts.c index b368844..fc86a5c 100644 --- a/fs/yaffs2/yaffs_guts.c +++ b/fs/yaffs2/yaffs_guts.c @@ -391,17 +391,17 @@ static int yaffs_CountChunkBits(yaffs_Device * dev, int blk) * Verification code */
-static int yaffs_SkipVerification(yaffs_Device *dev) +static Y_INLINE int yaffs_SkipVerification(yaffs_Device *dev) { return !(yaffs_traceMask & (YAFFS_TRACE_VERIFY | YAFFS_TRACE_VERIFY_FULL)); }
-static int yaffs_SkipFullVerification(yaffs_Device *dev) +static Y_INLINE int yaffs_SkipFullVerification(yaffs_Device *dev) { return !(yaffs_traceMask & (YAFFS_TRACE_VERIFY_FULL)); }
-static int yaffs_SkipNANDVerification(yaffs_Device *dev) +static Y_INLINE int yaffs_SkipNANDVerification(yaffs_Device *dev) { return !(yaffs_traceMask & (YAFFS_TRACE_VERIFY_NAND)); }

Dear Wolfgang Denk,
In message 1315483822-25399-6-git-send-email-wd@denx.de you wrote:
Fix these: yaffs_guts.c: At top level: yaffs_guts.c:400: warning: 'yaffs_SkipFullVerification' defined but not used
Testing shows no changes of the image sizes.
Signed-off-by: Wolfgang Denk wd@denx.de
fs/yaffs2/yaffs_guts.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
Applied, thanks.
Best regards,
Wolfgang Denk

Fix these: yaffs_guts.c: In function 'yaffs_ReadDataFromFile': yaffs_guts.c:4622: warning: pointer targets in passing argument 3 of 'yaffs_AddrToChunk' differ in signedness yaffs_guts.c:4622: warning: pointer targets in passing argument 4 of 'yaffs_AddrToChunk' differ in signedness yaffs_guts.c: In function 'yaffs_WriteDataToFile': yaffs_guts.c:4745: warning: pointer targets in passing argument 3 of 'yaffs_AddrToChunk' differ in signedness yaffs_guts.c:4745: warning: pointer targets in passing argument 4 of 'yaffs_AddrToChunk' differ in signedness yaffs_guts.c: In function 'yaffs_ResizeFile': yaffs_guts.c:4968: warning: pointer targets in passing argument 3 of 'yaffs_AddrToChunk' differ in signedness yaffs_guts.c:4968: warning: pointer targets in passing argument 4 of 'yaffs_AddrToChunk' differ in signedness yaffs_guts.c: In function 'yaffs_GutsInitialise': yaffs_guts.c:7235: warning: assignment from incompatible pointer type yaffs_guts.c: In function 'yaffs_CreateNewObject': yaffs_guts.c:2143: warning: 'tn' may be used uninitialized in this function yaffs_guts.c: In function 'yaffs_MknodObject': yaffs_guts.c:2258: warning: 'str' may be used uninitialized in this function
Signed-off-by: Wolfgang Denk wd@denx.de --- fs/yaffs2/yaffs_guts.c | 19 ++++++++++--------- 1 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/fs/yaffs2/yaffs_guts.c b/fs/yaffs2/yaffs_guts.c index fc86a5c..c67a085 100644 --- a/fs/yaffs2/yaffs_guts.c +++ b/fs/yaffs2/yaffs_guts.c @@ -2140,7 +2140,7 @@ yaffs_Object *yaffs_CreateNewObject(yaffs_Device * dev, int number, {
yaffs_Object *theObject; - yaffs_Tnode *tn; + yaffs_Tnode *tn = NULL;
if (number < 0) { number = yaffs_CreateNewObjectNumber(dev); @@ -2255,7 +2255,7 @@ static yaffs_Object *yaffs_MknodObject(yaffs_ObjectType type, const YCHAR * aliasString, __u32 rdev) { yaffs_Object *in; - YCHAR *str; + YCHAR *str = NULL;
yaffs_Device *dev = parent->myDev;
@@ -4605,8 +4605,8 @@ int yaffs_ReadDataFromFile(yaffs_Object * in, __u8 * buffer, loff_t offset, int nBytes) {
- int chunk; - int start; + __u32 chunk; + __u32 start; int nToCopy; int n = nBytes; int nDone = 0; @@ -4725,8 +4725,8 @@ int yaffs_WriteDataToFile(yaffs_Object * in, const __u8 * buffer, loff_t offset, int nBytes, int writeThrough) {
- int chunk; - int start; + __u32 chunk; + __u32 start; int nToCopy; int n = nBytes; int nDone = 0; @@ -4960,8 +4960,8 @@ int yaffs_ResizeFile(yaffs_Object * in, loff_t newSize) {
int oldFileSize = in->variant.fileVariant.fileSize; - int newSizeOfPartialChunk; - int newFullChunks; + __u32 newSizeOfPartialChunk; + __u32 newFullChunks;
yaffs_Device *dev = in->myDev;
@@ -7232,7 +7232,8 @@ int yaffs_GutsInitialise(yaffs_Device * dev) dev->nShortOpCaches = YAFFS_MAX_SHORT_OP_CACHES; }
- buf = dev->srCache = YMALLOC(srCacheBytes); + dev->srCache = YMALLOC(srCacheBytes); + buf = (__u8 *)dev->srCache;
if(dev->srCache) memset(dev->srCache,0,srCacheBytes);

Dear Wolfgang Denk,
In message 1315483822-25399-7-git-send-email-wd@denx.de you wrote:
Fix these: yaffs_guts.c: In function 'yaffs_ReadDataFromFile': yaffs_guts.c:4622: warning: pointer targets in passing argument 3 of 'yaffs_AddrToChunk' differ in signedness yaffs_guts.c:4622: warning: pointer targets in passing argument 4 of 'yaffs_AddrToChunk' differ in signedness yaffs_guts.c: In function 'yaffs_WriteDataToFile': yaffs_guts.c:4745: warning: pointer targets in passing argument 3 of 'yaffs_AddrToChunk' differ in signedness yaffs_guts.c:4745: warning: pointer targets in passing argument 4 of 'yaffs_AddrToChunk' differ in signedness yaffs_guts.c: In function 'yaffs_ResizeFile': yaffs_guts.c:4968: warning: pointer targets in passing argument 3 of 'yaffs_AddrToChunk' differ in signedness yaffs_guts.c:4968: warning: pointer targets in passing argument 4 of 'yaffs_AddrToChunk' differ in signedness yaffs_guts.c: In function 'yaffs_GutsInitialise': yaffs_guts.c:7235: warning: assignment from incompatible pointer type yaffs_guts.c: In function 'yaffs_CreateNewObject': yaffs_guts.c:2143: warning: 'tn' may be used uninitialized in this function yaffs_guts.c: In function 'yaffs_MknodObject': yaffs_guts.c:2258: warning: 'str' may be used uninitialized in this function
Signed-off-by: Wolfgang Denk wd@denx.de
fs/yaffs2/yaffs_guts.c | 19 ++++++++++--------- 1 files changed, 10 insertions(+), 9 deletions(-)
Applied, thanks.
Best regards,
Wolfgang Denk
participants (1)
-
Wolfgang Denk