-----Original Message-----
From: ofono-bounces(a)ofono.org [mailto:ofono-bounces@ofono.org] On Behalf
Of Marcel Holtmann
Sent: Friday, January 07, 2011 1:45 AM
To: ofono(a)ofono.org
Subject: Re: [PATCH] Fix compile warning at MeeGo The gcc version is MeeGo
4.5.1
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.
when l->data is NULL, but even then cond is initialized properly.
Regards
Marcel
_______________________________________________
ofono mailing list
ofono(a)ofono.org
http://lists.ofono.org/listinfo/ofono