isdn_v110 warning fix
PATCH 1/1 isdn_v110 warning fix
Warning fix :
drivers/isdn/i4l/isdn_v110.c:523: warning: `ret' might be used uninitialized in this function
---
drivers/isdn/i4l/isdn_v110.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/isdn/i4l/isdn_v110.c +2 -2
@@ -516,11 +516,11 @@ }int -isdn_v110_stat_callback (int idx,isdn_ctrl * c) +isdn_v110_stat_callback (int idx,isdn_ctrl *c) {isdn_v110_stream *v =NULL ;int i; -int ret; +int ret =0 ;if (idx <0 )return 0 ;
drivers/isdn/i4l/isdn_v110.c line 521
Quoted 13 lines · Jesper Juhl
drivers/isdn/i4l/isdn_v110.c:523: warning: `ret' might be used uninitialized in this functiondrivers/isdn/i4l/isdn_v110.c +2
-2@@ -516,11 +516,11 @@ -isdn_v110_stat_callback(int idx, isdn_ctrl * c) +isdn_v110_stat_callback(int idx, isdn_ctrl *c) { isdn_v110_stream *v = NULL;int i; -int ret; +int ret =0 ;
ret is used only in isdn_v110_stat_callback()::case ISDN_STAT_BSENT. It's possible for it to be unused only if passed c->parm.length is 0. Do you see codepaths that can do it?
Quoted 7 lines · Jesper Juhl
Quoted 5 lines
drivers/isdn/i4l/isdn_v110.c:523: warning: `ret' might be used uninitialized in this functiondrivers/isdn/i4l/isdn_v110.c +0
-0@@ -516,11 +516,11 @@
Quoted 12 lines
drivers/isdn/i4l/isdn_v110.c line 523
Quoted 7 lines
drivers/isdn/i4l/isdn_v110.c +2
-2-isdn_v110_stat_callback(int idx, isdn_ctrl * c) +isdn_v110_stat_callback(int idx, isdn_ctrl *c) { isdn_v110_stream *v = NULL;int i; -int ret; +int ret =0 ;ret is used only in isdn_v110_stat_callback()::case
ISDN_STAT_BSENT. It's possible for it to be unused only if passedc->parm.lengthis 0. Do you see codepaths that can do it?
initializing ret with the value zero is correct and should be done.
---------------------------------------------------
Thomas Pfeiffer, PDS - Programm + Datenservice GmbH
email: [email protected], http://www.pds.de/QFS-BILD
Tel: (49) 4261 855 614, Fax: (49) 4261 855 675
Quoted 7 lines · Alexey Dobriyan
Quoted 5 lines · Jesper Juhl
drivers/isdn/i4l/isdn_v110.c:523: warning: `ret' might be used uninitialized in this functiondrivers/isdn/i4l/isdn_v110.c +0
-0@@ -516,11 +516,11 @@
Quoted 12 lines
drivers/isdn/i4l/isdn_v110.c line 523
Quoted 7 lines
drivers/isdn/i4l/isdn_v110.c +2
-2-isdn_v110_stat_callback(int idx, isdn_ctrl * c) +isdn_v110_stat_callback(int idx, isdn_ctrl *c) { isdn_v110_stream *v = NULL;int i; -int ret; +int ret =0 ;ret is used only in isdn_v110_stat_callback()::case
ISDN_STAT_BSENT. It's possible for it to be unused only if passedc->parm.lengthis 0. Do you see codepaths that can do it?
No, I don't see any codepaths that could lead to it being used uninitialized. I made the patch for two reasons; 1) To silence the warning, and I
guess it's simply the right thing to do. 2) To make sure the code
behaves in a resonably sane way in case the situation c->parm.length==0 should somehow happen in the future.
Signature · 3 lines
Jesper Juhl <[email protected]> Don't top-post http://www.catb.org/~esr/jargon/html/T/top-post.html Plain text mails only, please http://www.expita.com/nomime.html
Quoted 1 line · Jesper Juhl
This is OK. Even if the codepath is never executed in a way that ret might be used uninitialized it does not harm to set ret = 0.
Warning fix :
drivers/isdn/i4l/isdn_v110.c:523: warning: `ret' might be used uninitialized in this function
---
drivers/isdn/i4l/isdn_v110.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/isdn/i4l/isdn_v110.c +2 -2
@@ -516,11 +516,11 @@ }int -isdn_v110_stat_callback (int idx,isdn_ctrl * c) +isdn_v110_stat_callback (int idx,isdn_ctrl *c) {isdn_v110_stream *v =NULL ;int i; -int ret; +int ret =0 ;if (idx <0 )return 0 ;
Quoted 7 lines · Karsten Keil
Quoted 1 line · Jesper Juhl
This is OK. Even if the codepath is never executed in a way that ret might be used uninitialized it does not harm to set ret = 0.
Quoted 6 lines
Warning fix :
drivers/isdn/i4l/isdn_v110.c:523: warning: `ret' might be used uninitialized in this functionSigned-off-by Jesper Juhl <[email protected]>Signed-off-by Karsten Keil <[email protected]>
Thank you for your feedback and for signing off on the patch. I'll forward it to Andrew for inclusion in -mm.
Signature · 3 lines
Jesper Juhl <[email protected]> Don't top-post http://www.catb.org/~esr/jargon/html/T/top-post.html Plain text mails only, please http://www.expita.com/nomime.html