]> www.infradead.org Git - mtd-utils.git/commitdiff
misc-utils: initialize "ip" in docfdisk to NULL
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>
Thu, 21 Sep 2017 14:16:22 +0000 (16:16 +0200)
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>
Thu, 5 Oct 2017 11:40:37 +0000 (13:40 +0200)
Technically it is initializied in the for loop right before being
used. From the conditional above, we know that the for loop is
executed at least once and the variable is always initialized, but
gcc doesn't appear to perform the same reasoning.

This patch adds an initialization of the variable for the sake of
making the compiler happy.

Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
misc-utils/docfdisk.c

index c2b915082fffad9a305fa3dfb0becf3352528647..486ce2980d5c218e7c2ea65c820e0768cb55ea58 100644 (file)
@@ -148,7 +148,7 @@ int main(int argc, char **argv)
        int ret, i, mhblock, unitsize, block;
        unsigned int nblocks[4], npart;
        unsigned int totblocks;
-       struct INFTLPartition *ip;
+       struct INFTLPartition *ip = NULL;
        unsigned char *oobbuf;
        struct mtd_oob_buf oob;
        char line[20];