[Yaffs] [PATCH] Fix compiler warnings in yaffs2/yaffs_guts.c…

Top Page
Attachments:
Message as email
+ (text/plain)
+ yaffs2_warning_fixes_cvs_2008_01_06.txt (text/plain)
Delete this message
Reply to this message
Author: Dirk Behme
Date:  
To: yaffs
Subject: [Yaffs] [PATCH] Fix compiler warnings in yaffs2/yaffs_guts.c from recent CVS

Testing recent YAFFS2 CVS from today on Linux 2.6.23 compiling with
ARM cross compiler I get the following warnings:

fs/yaffs2/yaffs_guts.c: In function 'yaffs_VerifyTnodeWorker':
fs/yaffs2/yaffs_guts.c:600: warning: unused variable 'nTnodeBytes'
fs/yaffs2/yaffs_guts.c: In function 'yaffs_VerifyFile':
fs/yaffs2/yaffs_guts.c:649: warning: unused variable 'ok'
fs/yaffs2/yaffs_guts.c: In function 'yaffs_GutsInitialise':
fs/yaffs2/yaffs_guts.c:7276: warning: assignment from incompatible
pointer type
fs/yaffs2/yaffs_guts.c: At top level:
fs/yaffs2/yaffs_guts.c:394: warning: 'yaffs_SkipFullVerification'
defined but not used
fs/yaffs2/yaffs_guts.c: In function 'yaffs_CreateNewObject':
fs/yaffs2/yaffs_guts.c:2146: warning: 'tn' may be used uninitialized
in this function
fs/yaffs2/yaffs_guts.c: In function 'yaffs_MknodObject':
fs/yaffs2/yaffs_guts.c:2261: warning: 'str' may be used uninitialized
in this function

Attached patch fixes this.

Signed-off-by: Dirk Behme <>

Regards

Dirk

Index: linux-davinci/fs/yaffs2/yaffs_guts.c
===================================================================
--- linux-davinci.orig/fs/yaffs2/yaffs_guts.c
+++ linux-davinci/fs/yaffs2/yaffs_guts.c
@@ -390,11 +390,6 @@ static int yaffs_SkipVerification(yaffs_
     return !(yaffs_traceMask & (YAFFS_TRACE_VERIFY | YAFFS_TRACE_VERIFY_FULL));
 }


-static int yaffs_SkipFullVerification(yaffs_Device *dev)
-{
-    return !(yaffs_traceMask & (YAFFS_TRACE_VERIFY_FULL));
-}
-
 static int yaffs_SkipNANDVerification(yaffs_Device *dev)
 {
     return !(yaffs_traceMask & (YAFFS_TRACE_VERIFY_NAND));
@@ -597,7 +592,6 @@ static int yaffs_VerifyTnodeWorker(yaffs
     int i;
     yaffs_Device *dev = obj->myDev;
     int ok = 1;
-    int nTnodeBytes = (dev->tnodeWidth * YAFFS_NTNODES_LEVEL0)/8;


     if (tn) {
         if (level > 0) {
@@ -646,7 +640,6 @@ static void yaffs_VerifyFile(yaffs_Objec
     __u32 lastChunk;
     __u32 x;
     __u32 i;
-    int ok;
     yaffs_Device *dev;
     yaffs_ExtendedTags tags;
     yaffs_Tnode *tn;
@@ -2143,7 +2136,7 @@ yaffs_Object *yaffs_CreateNewObject(yaff
 {


     yaffs_Object *theObject;
-    yaffs_Tnode *tn;
+    yaffs_Tnode *tn = NULL;


     if (number < 0) {
         number = yaffs_CreateNewObjectNumber(dev);
@@ -2258,7 +2251,7 @@ static yaffs_Object *yaffs_MknodObject(y
                        const YCHAR * aliasString, __u32 rdev)
 {
     yaffs_Object *in;
-    YCHAR *str;
+    YCHAR *str = NULL;


     yaffs_Device *dev = parent->myDev;


@@ -7273,7 +7266,8 @@ int yaffs_GutsInitialise(yaffs_Device * 
             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);