* [PATCH] mtd/ubi: silence gcc warning
@ 2007-05-27 11:32 Jeff Garzik
2007-05-27 12:48 ` Josh Boyer
2007-05-27 12:54 ` Artem Bityutskiy
0 siblings, 2 replies; 3+ messages in thread
From: Jeff Garzik @ 2007-05-27 11:32 UTC (permalink / raw)
To: Andrew Morton, dedekind; +Cc: linux-mtd, LKML
Silence the gcc warning
drivers/mtd/ubi/eba.c: In function ‘ubi_eba_read_leb’:
drivers/mtd/ubi/eba.c:371: warning: ‘crc’ may be used uninitialized in this function
This is an example of the uninit'd-var warnings emitted by gcc that
can be proven to be bogus.
Normally I would commit this to my git repository containing
such verified cases, but with all the goto-driven control flow in
ubi_eba_read_leb(), I feel that initializing the 'crc' variable is
an easy way to both shut up gcc, and also make the code less fragile
for the long term.
Signed-off-by: Jeff Garzik <jeff@garzik.org>
diff --git a/drivers/mtd/ubi/eba.c b/drivers/mtd/ubi/eba.c
index 7400294..3fe1722 100644
--- a/drivers/mtd/ubi/eba.c
+++ b/drivers/mtd/ubi/eba.c
@@ -368,7 +368,7 @@ int ubi_eba_read_leb(struct ubi_device *ubi, int vol_id, int lnum, void *buf,
int err, pnum, scrub = 0, idx = vol_id2idx(ubi, vol_id);
struct ubi_vid_hdr *vid_hdr;
struct ubi_volume *vol = ubi->volumes[idx];
- uint32_t crc, crc1;
+ uint32_t crc = 0, crc1;
err = leb_read_lock(ubi, vol_id, lnum);
if (err)
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] mtd/ubi: silence gcc warning
2007-05-27 11:32 [PATCH] mtd/ubi: silence gcc warning Jeff Garzik
@ 2007-05-27 12:48 ` Josh Boyer
2007-05-27 12:54 ` Artem Bityutskiy
1 sibling, 0 replies; 3+ messages in thread
From: Josh Boyer @ 2007-05-27 12:48 UTC (permalink / raw)
To: Jeff Garzik; +Cc: Andrew Morton, linux-mtd, LKML
On Sun, 2007-05-27 at 07:32 -0400, Jeff Garzik wrote:
> Silence the gcc warning
>
> drivers/mtd/ubi/eba.c: In function ‘ubi_eba_read_leb’:
> drivers/mtd/ubi/eba.c:371: warning: ‘crc’ may be used uninitialized in this function
>
> This is an example of the uninit'd-var warnings emitted by gcc that
> can be proven to be bogus.
>
> Normally I would commit this to my git repository containing
> such verified cases, but with all the goto-driven control flow in
> ubi_eba_read_leb(), I feel that initializing the 'crc' variable is
> an easy way to both shut up gcc, and also make the code less fragile
> for the long term.
>
> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Acked-by: Josh Boyer <jwboyer@linux.vnet.ibm.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] mtd/ubi: silence gcc warning
2007-05-27 11:32 [PATCH] mtd/ubi: silence gcc warning Jeff Garzik
2007-05-27 12:48 ` Josh Boyer
@ 2007-05-27 12:54 ` Artem Bityutskiy
1 sibling, 0 replies; 3+ messages in thread
From: Artem Bityutskiy @ 2007-05-27 12:54 UTC (permalink / raw)
To: Jeff Garzik; +Cc: Andrew Morton, linux-mtd, LKML
On Sun, 2007-05-27 at 07:32 -0400, Jeff Garzik wrote:
> Silence the gcc warning
>
> drivers/mtd/ubi/eba.c: In function ‘ubi_eba_read_leb’:
> drivers/mtd/ubi/eba.c:371: warning: ‘crc’ may be used uninitialized in this function
>
> This is an example of the uninit'd-var warnings emitted by gcc that
> can be proven to be bogus.
>
> Normally I would commit this to my git repository containing
> such verified cases, but with all the goto-driven control flow in
> ubi_eba_read_leb(), I feel that initializing the 'crc' variable is
> an easy way to both shut up gcc, and also make the code less fragile
> for the long term.
Committed to the UBI git tree, thanks.
--
Best regards,
Artem Bityutskiy (Битюцкий Артём)
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2007-05-27 12:55 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-05-27 11:32 [PATCH] mtd/ubi: silence gcc warning Jeff Garzik
2007-05-27 12:48 ` Josh Boyer
2007-05-27 12:54 ` Artem Bityutskiy
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).