Skip to contentSkip to conversation

YAFFS2: fix build warnings

PATCH New Wolfgang Denk 1 participant 13 messages Sep 8, 2011 – Sep 9, 2011

lore
Share & tools
lore
#0 lore raw

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
#1 lore raw

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
index 7c01ea2..0e22d90 100644
@@ -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
#3 lore raw

PATCH 2/6 YAFFS2: fs/yaffs2/yaffscfg.c - fix build warnings

In reply to 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'

---
 fs/yaffs2/yaffscfg.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
fs/yaffs2/yaffscfg.c +2 -2
index 16e84a4..01399ea 100644
@@ -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
#5 lore raw

PATCH 3/6 YAFFS2: fs/yaffs2/Makefile - fix build warnings

In reply to 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.

---
 fs/yaffs2/Makefile |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
fs/yaffs2/Makefile +1 -1
index 7753cfc..6c50c81 100644
@@ -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
#7 lore raw

PATCH 4/6 YAFFS2: fs/yaffs2/yaffs_nand.[hc] - fix build warnings

In reply to 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

---
 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
index e790be6..ce048cc 100644
@@ -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
index 48e3f7e..f3bedcf 100644
@@ -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
#9 lore raw

PATCH 5/6 YAFFS2: fs/yaffs2/yaffs_guts.c - fix build warnings

In reply to 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.

---
 fs/yaffs2/yaffs_guts.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
fs/yaffs2/yaffs_guts.c +3 -3
index b368844..fc86a5c 100644
@@ -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
#11 lore raw

PATCH 6/6 YAFFS2: fs/yaffs2/yaffs_guts.c - fix build warnings

In reply to 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

---
 fs/yaffs2/yaffs_guts.c |   19 ++++++++++---------
 1 files changed, 10 insertions(+), 9 deletions(-)
fs/yaffs2/yaffs_guts.c +10 -9
index fc86a5c..c67a085 100644
@@ -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
author Applied
#2 lore raw

PATCH 1/6 YAFFS2: cmd_yaffs2.c - fix build warnings

In reply to Wolfgang Denk

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'

---
 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
author Applied
#4 lore raw

PATCH 2/6 YAFFS2: fs/yaffs2/yaffscfg.c - fix build warnings

In reply to Wolfgang Denk

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'

---
 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."
author Applied
#6 lore raw

PATCH 3/6 YAFFS2: fs/yaffs2/Makefile - fix build warnings

In reply to Wolfgang Denk

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 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(-)

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.
author Applied
#8 lore raw

PATCH 4/6 YAFFS2: fs/yaffs2/yaffs_nand.[hc] - fix build warnings

In reply to Wolfgang Denk

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 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

Quoted 5 lines
---
 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.
author Applied
#10 lore raw

PATCH 5/6 YAFFS2: fs/yaffs2/yaffs_guts.c - fix build warnings

In reply to Wolfgang Denk

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 used

Testing shows no changes of the image sizes.

---
 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_
author Applied
#12 lore raw

PATCH 6/6 YAFFS2: fs/yaffs2/yaffs_guts.c - fix build warnings

In reply to Wolfgang Denk

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 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

Quoted 4 lines
---
 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