Subject: Re: [PATCH net-next v2] ipv4: ip_gre: Fix set but not used warning in ipgre_err() if IPv4-only

From: Simon Horman <[email-masked]>
Date: Mon, 20 Jan 2025 16:26:05 +0000

On Mon, Jan 20, 2025 at 02:12:36PM +0100, Geert Uytterhoeven wrote:
> if CONFIG_NET_IPGRE is enabled, but CONFIG_IPV6 is disabled:
> 
>     net/ipv4/ip_gre.c: In function ‘ipgre_err’:
>     net/ipv4/ip_gre.c:144:22: error: variable ‘data_len’ set but not used [-Werror=unused-but-set-variable]
>       144 |         unsigned int data_len = 0;
> 	  |                      ^~~~~~~~
> 
> Fix this by moving all data_len processing inside the IPV6-only section
> that uses its result.
> 
> Reported-by: kernel test robot <[email-masked]>
> Closes: https://lore.kernel.org/oe-kbuild-all/[email-masked]/
> Signed-off-by: Geert Uytterhoeven <[email-masked]>
> ---
> v2:
>   - Do not use the ternary operator,
>   - Target net-next.

Thanks Geert,

This has been bothering me too.

Reviewed-by: Simon Horman <[email-masked]>