- fix compile warning: `found' might be used uninitialized in this function
PATCH 1/1 - fix compile warning: `found' might be used uninitialized in this function
Hello !
the attached patch should fix the following compile warning:
fs/block_dev.c: In function `bd_claim_by_kobject':fs/block_dev.c:953: warning: `found' might be used uninitialized in this function
i`m an absolutely awful programmer , but feel free to comment, ignore or .... merge.
regards
Roland Kletzing
fs/block_dev.c 2007-03-22 00:07:33.875694264 +0100 renamed from fs/block_dev.c.orig 2007-03-22 00:07:49.270353920 +0100 +0 -0
@@ -950,7 +950,7 @@ struct kobject *kobj)
{
int res;- struct bd_holder *bo, *found;
+ struct bd_holder *bo, *found = NULL;
if (!kobj)
return -EINVAL; Hi,
Quoted 3 lines · roland
fs/block_dev.c: In function `bd_claim_by_kobject':fs/block_dev.c:953: warning: `found' might be used uninitialized in this function
found actually _is_ used uninitialized if the call to bd_claim() returns anything but 0. Thank you!
=Hannes
Quoted 7 lines · On Thu, 22 Mar 2007 00:56:08 +0100 Johannes Weiner…
Quoted 3 lines · roland
fs/block_dev.c: In function `bd_claim_by_kobject':fs/block_dev.c:953: warning: `found' might be used uninitialized in this functionfound actually _is_ used uninitialized if the call to
bd_claim()returns anything but 0.
No, it isn't.
if (res || found)
free_bd_holder(bo);`found' won't be evaluated if res!=0.
The code in there is irksome - it'd be nice to find some way of restructuring it to make it less obscure, and to kill that warning.
Hi,
Quoted 8 lines · Andrew Morton
Quoted 7 lines · roland
Quoted 3 lines
fs/block_dev.c: In function `bd_claim_by_kobject':fs/block_dev.c:953: warning: `found' might be used uninitialized in this functionfound actually _is_ used uninitialized if the call to
bd_claim()returns anything but 0.
Quoted 6 lines
No, it isn't.
if (res || found) free_bd_holder(bo);`found' won't be evaluated if res!=0.
Oh, thank you very much. So this warning is another gcc false-positive?
Quoted 2 lines
The code in there is irksome - it'd be nice to find some way of restructuring it to make it less obscure, and to kill that warning.
Functionscope or filescope? ;)
=Hannes
Hi,
Quoted 4 lines · Johannes Weiner
Quoted 2 lines
The code in there is irksome - it'd be nice to find some way of restructuring it to make it less obscure, and to kill that warning.
Functionscope or filescope? ;)
Oh well... I think the latter. I wil clean it up and send the patches in several steps to seperate opticals from functionals.
=Hannes