Subject: Re: [PATCH] netlink: silence compiler warning

From: Marcel Holtmann <[email-masked]>
Date: Sat, 05 Sep 2009 03:08:01 +0200

Hi Brian,

> CC      net/netlink/genetlink.o
> net/netlink/genetlink.c: In function ‘genl_register_mc_group’:
> net/netlink/genetlink.c:139: warning: ‘err’ may be used uninitialized in this function
> 
> From following the code 'err' is initialized, but set it to zero to
> silence the warning.
> 
> Signed-off-by: Brian Haley <[email-masked]>
> ---
> 
> diff --git a/net/netlink/genetlink.c b/net/netlink/genetlink.c
> index 575c643..66f6ba0 100644
> --- a/net/netlink/genetlink.c
> +++ b/net/netlink/genetlink.c
> @@ -136,7 +136,7 @@ int genl_register_mc_group(struct genl_family *family,
>  {
>  	int id;
>  	unsigned long *new_groups;
> -	int err;
> +	int err = 0;
>  
>  	BUG_ON(grp->name[0] == '\0');

can we please add the err = -E... where it actually is needed and not
stupidly go ahead and silence compiler warnings with err = 0. This has
been posted before.

Regards

Marcel