YAFFS2: fix build warnings
cover 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(-)
Signature · 1 line
1.7.6
PATCH 1/6 YAFFS2: cmd_yaffs2.c - fix build warnings
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'
--- common/cmd_yaffs2.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
common/cmd_yaffs2.c +1 -1
@@ -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);
Signature · 1 line
1.7.6
Wolfgang Denk
AppliedPATCH 1/6 YAFFS2: cmd_yaffs2.c - fix build warnings
Dear Wolfgang Denk,
Quoted 9 lines · In message <[email protected]> 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 <[email protected]>--- common/cmd_yaffs2.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
Applied, thanks.
Best regards,
Wolfgang Denk
Signature · 8 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel 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 Remember thee Ay, thou poor ghost while memory holds a seat In this distracted globe. Remember thee! Yea, from the table of my memory I'll wipe away all trivial fond records, All saws of books, all forms, all pressures past, That youth and observation copied there. Hamlet, I : v : 95 William Shakespeare
PATCH 2/6 YAFFS2: fs/yaffs2/yaffscfg.c - fix build warnings
In reply to Wolfgang DenkFix 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'
--- fs/yaffs2/yaffscfg.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
fs/yaffs2/yaffscfg.c +2 -2
@@ -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 {
Signature · 1 line
1.7.6
Wolfgang Denk
AppliedPATCH 2/6 YAFFS2: fs/yaffs2/yaffscfg.c - fix build warnings
Dear Wolfgang Denk,
Quoted 9 lines · In message <[email protected]> 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 <[email protected]>--- fs/yaffs2/yaffscfg.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
Applied, thanks.
Best regards,
Wolfgang Denk
Signature · 6 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel 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 HR Manager to job candidate "I see you've had no computer training. Although that qualifies you for upper management, it means you're under-qualified for our entry level positions."
PATCH 3/6 YAFFS2: fs/yaffs2/Makefile - fix build warnings
In reply to Wolfgang DenkDrop 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.
--- fs/yaffs2/Makefile | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
fs/yaffs2/Makefile +1 -1
@@ -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)
Signature · 1 line
1.7.6
Wolfgang Denk
AppliedPATCH 3/6 YAFFS2: fs/yaffs2/Makefile - fix build warnings
Dear Wolfgang Denk,
Quoted 11 lines · In message <[email protected]> you wrote:
Drop the "-DNO_Y_INLINE" setting to fix these:
yaffs_guts.h:806: warning: 'yaffs_GetBlockInfo' defined but not usedImpact 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 <[email protected]>--- fs/yaffs2/Makefile | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
Applied, thanks.
Best regards,
Wolfgang Denk
Signature · 5 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel 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 The goal of science is to build better mousetraps. The goal of nature is to build better mice.
PATCH 4/6 YAFFS2: fs/yaffs2/yaffs_nand.[hc] - fix build warnings
In reply to Wolfgang DenkFix 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
--- fs/yaffs2/yaffs_nand.c | 2 +- fs/yaffs2/yaffs_nand.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
fs/yaffs2/yaffs_nand.c +1 -1
@@ -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;
fs/yaffs2/yaffs_nand.h +1 -1
@@ -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);
Signature · 1 line
1.7.6
Wolfgang Denk
AppliedPATCH 4/6 YAFFS2: fs/yaffs2/yaffs_nand.[hc] - fix build warnings
Dear Wolfgang Denk,
Quoted 9 lines · In message <[email protected]> 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 signednessyaffs_guts.c: In function 'yaffs_ScanBackwards':
yaffs_guts.c:6017: warning: pointer targets in passing argument 4 of 'yaffs_QueryInitialBlockState' differ in signednessyaffs_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
Quoted 5 lines
Signed-off-by Wolfgang Denk <[email protected]>--- 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
Signature · 5 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel 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 Q: Do you know what the death rate around here is? A: One per person.
PATCH 5/6 YAFFS2: fs/yaffs2/yaffs_guts.c - fix build warnings
In reply to Wolfgang DenkFix 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.
--- fs/yaffs2/yaffs_guts.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
fs/yaffs2/yaffs_guts.c +3 -3
@@ -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 )); }
Signature · 1 line
1.7.6
Wolfgang Denk
AppliedPATCH 5/6 YAFFS2: fs/yaffs2/yaffs_guts.c - fix build warnings
Dear Wolfgang Denk,
Quoted 10 lines · In message <[email protected]> you wrote:
Fix these:
yaffs_guts.c: At top level:
yaffs_guts.c:400: warning: 'yaffs_SkipFullVerification' defined but not usedTesting shows no changes of the image sizes.
Signed-off-by Wolfgang Denk <[email protected]>--- fs/yaffs2/yaffs_guts.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
Applied, thanks.
Best regards,
Wolfgang Denk
Signature · 6 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel 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 Far back in the mists of ancient time, in the great and glorious days of the former Galactic Empire, life was wild, rich and largely tax free. - Douglas Adams, _The Hitchhiker's Guide to the Galaxy_
PATCH 6/6 YAFFS2: fs/yaffs2/yaffs_guts.c - fix build warnings
In reply to Wolfgang DenkFix 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 typeyaffs_guts.c: In function 'yaffs_CreateNewObject':
yaffs_guts.c:2143: warning: 'tn' may be used uninitialized in this functionyaffs_guts.c: In function 'yaffs_MknodObject':
yaffs_guts.c:2258: warning: 'str' may be used uninitialized in this function
--- fs/yaffs2/yaffs_guts.c | 19 ++++++++++--------- 1 files changed, 10 insertions(+), 9 deletions(-)
fs/yaffs2/yaffs_guts.c +10 -9
@@ -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);
Signature · 1 line
1.7.6
Wolfgang Denk
AppliedPATCH 6/6 YAFFS2: fs/yaffs2/yaffs_guts.c - fix build warnings
Dear Wolfgang Denk,
Quoted 17 lines · In message <[email protected]> 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 signednessyaffs_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 signednessyaffs_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 signednessyaffs_guts.c: In function 'yaffs_GutsInitialise':
yaffs_guts.c:7235: warning: assignment from incompatible pointer typeyaffs_guts.c: In function 'yaffs_CreateNewObject':
yaffs_guts.c:2143: warning: 'tn' may be used uninitialized in this functionyaffs_guts.c: In function 'yaffs_MknodObject':
yaffs_guts.c:2258: warning: 'str' may be used uninitialized in this function
Quoted 4 lines
Signed-off-by Wolfgang Denk <[email protected]>--- fs/yaffs2/yaffs_guts.c | 19 ++++++++++--------- 1 files changed, 10 insertions(+), 9 deletions(-)
Applied, thanks.
Best regards,
Wolfgang Denk
Signature · 6 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel 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 "The combination of a number of things to make existence worthwhile." "Yes, the philosophy of 'none,' meaning 'all.'" -- Spock and Lincoln, "The Savage Curtain", stardate 5906.4