Enable further warning flags, address new warnings
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>
Wed, 1 Nov 2017 22:08:45 +0000 (23:08 +0100)
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>
Fri, 3 Nov 2017 18:41:32 +0000 (19:41 +0100)
mtd_debug: Remove a duplicate if case. MTD_CAP_NANDFLASH has only one
flag set (MTD_WRITEABLE). Directly below, we had a check for
MTD_WRITEABLE in the else branch which can't possible ever have
triggered. Checking for MTD_WRITEABLE in addition to the CAP constants
was probably not intended anyway, given the check for the individual
flags if all else fails.

integck: We already established that "r" is less than the number of
elements in the list, so the loop condition doesn't need to check
if w is NULL in addition. At least this way, the compiler "gets"
that w cannot be NULL below and doesn't issue warnings.

Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
configure.ac
misc-utils/mtd_debug.c
tests/fs-tests/integrity/integck.c

index 3223c61457410983788b5f8f36368eeb11987ba3..83d754f852c9bfef704d207bf6d1869cea6dbe79 100644 (file)
@@ -40,6 +40,10 @@ UL_WARN_ADD([-Wunused-but-set-variable])
 UL_WARN_ADD([-Wunused-parameter])
 UL_WARN_ADD([-Wunused-result])
 UL_WARN_ADD([-Wunused-variable])
+UL_WARN_ADD([-Wduplicated-cond])
+UL_WARN_ADD([-Wduplicated-branches])
+UL_WARN_ADD([-Wrestrict])
+UL_WARN_ADD([-Wnull-dereference])
 
 UL_WARN_ADD([-Wno-shadow])
 UL_WARN_ADD([-Wno-sign-compare])
index 1fd68712e2e26666029c7ca261694852a17722fd..ac37e23331e39f3dab71a4ab41ddca632565f11b 100644 (file)
@@ -286,8 +286,6 @@ static int showinfo(int fd)
                printf("MTD_CAP_NORFLASH");
        else if (mtd.flags == MTD_CAP_NANDFLASH)
                printf("MTD_CAP_NANDFLASH");
-       else if (mtd.flags == MTD_WRITEABLE)
-               printf("MTD_WRITEABLE");
        else {
                int first = 1;
                static struct {
index cac145dec7835eebc861e444d0d96119b4ba0efa..84753d681659ab1a0a619824d7ec90d963d1cc4f 100644 (file)
@@ -1164,7 +1164,7 @@ static int file_mmap_write(struct file_info *file)
        }
        r = random_no(write_cnt);
        w = file->writes;
-       for (i = 0; w && w->next && i < r; i++)
+       for (i = 0; i < r; i++)
                w = w->next;
 
        offs = (w->offset / fsinfo.page_size) * fsinfo.page_size;