[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <3a7b4d28-1700-7545-c1b7-7d2d463a17d7@dev.mellanox.co.il>
Date: Wed, 26 Oct 2016 09:51:04 +0300
From: Yishai Hadas <yishaih@....mellanox.co.il>
To: Arnd Bergmann <arnd@...db.de>
Cc: Yishai Hadas <yishaih@...lanox.com>,
"David S. Miller" <davem@...emloft.net>,
Jack Morgenstein <jackm@....mellanox.co.il>,
Or Gerlitz <ogerlitz@...lanox.com>,
Eran Ben Elisha <eranbe@...lanox.com>,
Moshe Shemesh <moshe@...lanox.com>,
Christophe Jaillet <christophe.jaillet@...adoo.fr>,
Moni Shoua <monis@...lanox.com>, netdev@...r.kernel.org,
linux-rdma@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] IB/mlx4: avoid a -Wmaybe-uninitialize warning
On 10/25/2016 7:16 PM, Arnd Bergmann wrote:
> There is an old warning about mlx4_SW2HW_EQ_wrapper on x86:
>
> ethernet/mellanox/mlx4/resource_tracker.c: In function ‘mlx4_SW2HW_EQ_wrapper’:
> ethernet/mellanox/mlx4/resource_tracker.c:3071:10: error: ‘eq’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
>
> The problem here is that gcc won't track the state of the variable
> across a spin_unlock. Moving the assignment out of the lock is
> safe here and avoids the warning.
>
> Signed-off-by: Arnd Bergmann <arnd@...db.de>
Reviewed-by: Yishai Hadas <yishaih@...lanox.com>
> ---
> drivers/net/ethernet/mellanox/mlx4/resource_tracker.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
> index 84d7857ccc27..c548beaaf910 100644
> --- a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
> +++ b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
> @@ -1605,13 +1605,14 @@ static int eq_res_start_move_to(struct mlx4_dev *dev, int slave, int index,
> r->com.from_state = r->com.state;
> r->com.to_state = state;
> r->com.state = RES_EQ_BUSY;
> - if (eq)
> - *eq = r;
> }
> }
>
> spin_unlock_irq(mlx4_tlock(dev));
>
> + if (!err && eq)
> + *eq = r;
> +
> return err;
> }
>
>
Powered by blists - more mailing lists