[PATCH 3/8] firmware: initialize variables

Holger Hans Peter Freyther holger at freyther.de
Wed Nov 23 23:07:23 UTC 2011


On 11/23/2011 11:59 PM, Alexander Huemer wrote:

> +++ b/src/target/firmware/layer1/mframe_sched.c
> @@ -332,7 +332,7 @@ static const struct mframe_sched_item *sched_set_for_task[32] = {
>  /* encodes a channel number according to 08.58 Chapter 9.3.1 */
>  uint8_t mframe_task2chan_nr(enum mframe_task mft, uint8_t ts)
>  {
> -	uint8_t cbits;
> +	uint8_t cbits = 0;
>  
>  	switch (mft) {
>  	case MF_TASK_BCCH_NORM:

uninitialized variables are tricky. In this case it is more the question of
which enum value is not handled in the switch/case statement (or if the gcc
fails to look at all values of the enum).
E.g. a

default:
  cbits = 0;
  BIG_WARNING(mft);

might be better?




More information about the baseband-devel mailing list