Messages in this thread Patch in this message | | | Date | Wed, 9 Jun 2004 01:32:06 +0200 (CEST) | From | Jesper Juhl <> | Subject | [PATCH] Kill uninitialized variable warning in drivers/isdn/i4l/isdn_v110.c |
| |
Hi,
Here's a small patch to shut up a gcc warning about 'ret' being possibly used uninitialized in drivers/isdn/i4l/isdn_v110.c::isdn_v110_stat_callback
drivers/isdn/i4l/isdn_v110.c: In function `isdn_v110_stat_callback': drivers/isdn/i4l/isdn_v110.c:523: warning: `ret' might be used uninitialized in this function
I've read through the code, and as I read it, to use ret uninitialized we'd have to never enter the for() loop at all for the c->command == ISDN_STAT_BSENT case, which (as I read the code) can never happen. So, I believe everything is OK and the gcc warning is bogus in this case - so the patch simply shuts up gcc by initially initializing 'ret' to zero (which looks to be a sane value sane even if the case of v->framelen being initially greater than c->parm.length should ever happen in some freak case I'm not aware of).
Comments are always welcome.
Patch is against 2.6.7-rc3 :
--- linux-2.6.7-rc3/drivers/isdn/i4l/isdn_v110.c-orig 2004-06-09 01:18:18.000000000 +0200 +++ linux-2.6.7-rc3/drivers/isdn/i4l/isdn_v110.c 2004-06-09 01:22:33.000000000 +0200 @@ -520,7 +520,7 @@ isdn_v110_stat_callback(int idx, isdn_ct { isdn_v110_stream *v = NULL; int i; - int ret; + int ret = 0;
if (idx < 0) return 0;
-- Jesper Juhl <juhl-lkml@dif.dk>
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |