Hi Martin,

> > >  src/call-forwarding.c |    2 +-
> > >  1 files changed, 1 insertions(+), 1 deletions(-)
> > >
> > > diff --git a/src/call-forwarding.c b/src/call-forwarding.c
> > > index 512f223..36ba4f1 100644
> > > --- a/src/call-forwarding.c
> > > +++ b/src/call-forwarding.c
> > > @@ -246,7 +246,7 @@ static gboolean is_cfu_enabled(struct
> > ofono_call_forwarding *cf,
> > >  static void sim_set_cf_indicator(struct ofono_call_forwarding *cf)
> > >  {
> > >   gboolean cfu_voice;
> > > - struct ofono_call_forwarding_condition *cond;
> > > + struct ofono_call_forwarding_condition *cond = NULL;
> > >
> > >   cfu_voice = is_cfu_enabled(cf, &cond);
> > 
> > I really hate trying to fix compiler warnings like this.
> > 
> >         /*
> >          * For now we only support Voice, although Fax & all Data
> >          * basic services are applicable as well.
> >          */
> >         for (; l; l = l->next) {
> >                 cond = l->data;
> > 
> >                 if (cond->cls > BEARER_CLASS_VOICE)
> >                         continue;
> > 
> >                 if (out)
> >                         *out = cond;
> > 
> >                 return TRUE;
> >         }
> > 
> >         return FALSE;
> > 
> > So this is clearly a false positive. The only why this would fail is
> This is not a false positive, it is quite possible not to reach the "for(;;)" 
> branch, and uninitialized the *cond.
> I have added
> *out = NULL;
> Out of the branch, and found that the warning gone.
> So here I think gcc is right, and we need the patch.

it is a false positive.

The only caller that uses the cond value is sim_set_cf_indicator. And it
only uses conf if the return value is TRUE. So where can this go wrong?

Regards

Marcel


_______________________________________________
ofono mailing list
[email protected]
http://lists.ofono.org/listinfo/ofono

Reply via email to