Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

block: fix bogus gcc warning for uninitialized var usage

Newer gcc throw this warning:

fs/bio.c: In function ?bio_alloc_bioset?:
fs/bio.c:305: warning: ?p? may be used uninitialized in this function

since it cannot figure out that 'p' is only ever used if 'bs' is non-NULL.

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>

+1 -1
+1 -1
fs/bio.c
··· 302 302 struct bio *bio_alloc_bioset(gfp_t gfp_mask, int nr_iovecs, struct bio_set *bs) 303 303 { 304 304 struct bio *bio = NULL; 305 - void *p; 305 + void *uninitialized_var(p); 306 306 307 307 if (bs) { 308 308 p = mempool_alloc(bs->bio_pool, gfp_mask);