Re: Regarding unintialized variables | |
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] | |
debian developer wrote:
> Hello,
>
> Consider the following code snippet...
>
> const char *type;
>
> switch (rfkill->type) {
> case RFKILL_TYPE_WLAN:
> type = "wlan";
> break;
> case RFKILL_TYPE_BLUETOOTH:
> type = "bluetooth";
> break;
> case RFKILL_TYPE_UWB:
> type = "ultrawideband";
> break;
> case RFKILL_TYPE_WIMAX:
> type = "wimax";
> break;
> default:
> BUG();
> }
>
>
> It is clear that type will be set or BUG() called. Why don't we
> initialize type to NULL during declaration??
>
or const char *uninitialized_var(type);
but IMO NULL is ok also.
> char *type = NULL;
>
> should fix the warning which i get
> warning: 'type' might be used uninitialized in this function
>
> Please let me know so that i can submit a patch for that.
>
> Thanks.
>
--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ
[Newbies FAQ] [Kernel List] [Site Home] [IETF Annouce] [Git] [Networking] [Security] [Bugtraq] [Rubini] [Photo] [Yosemite] [MIPS Linux] [ARM Linux] [Linux Security] [Linux Networking] [Linux RAID] [Linux SCSI] [Linux ACPI] [DDR & Rambus] [UNIX Filesystems] [Linux Resources]
![]() |
![]() |