diff mbox series

[1/1] drivers/infiniband/sw/siw/siw_qp_rx.c: suppress uninitialized var warning

Message ID 20200323184627.ZWPg91uin%akpm@linux-foundation.org (mailing list archive)
State Accepted
Delegated to: Jason Gunthorpe
Headers show
Series [1/1] drivers/infiniband/sw/siw/siw_qp_rx.c: suppress uninitialized var warning | expand

Commit Message

Andrew Morton March 23, 2020, 6:46 p.m. UTC
From: Andrew Morton <akpm@linux-foundation.org>
Subject: drivers/infiniband/sw/siw/siw_qp_rx.c: suppress uninitialized var warning

drivers/infiniband/sw/siw/siw_qp_rx.c: In function siw_proc_send:
./include/linux/spinlock.h:288:3: warning: flags may be used uninitialized in this function [-Wmaybe-uninitialized]
   _raw_spin_unlock_irqrestore(lock, flags); \
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/infiniband/sw/siw/siw_qp_rx.c:335:16: note: flags was declared here
  unsigned long flags;

Cc: Bernard Metzler <bmt@zurich.ibm.com>
Cc: Doug Ledford <dledford@redhat.com>
Cc: Jason Gunthorpe <jgg@ziepe.ca>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 drivers/infiniband/sw/siw/siw_qp_rx.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Leon Romanovsky March 24, 2020, 6:46 a.m. UTC | #1
On Mon, Mar 23, 2020 at 11:46:27AM -0700, akpm@linux-foundation.org wrote:
> From: Andrew Morton <akpm@linux-foundation.org>
> Subject: drivers/infiniband/sw/siw/siw_qp_rx.c: suppress uninitialized var warning
>
> drivers/infiniband/sw/siw/siw_qp_rx.c: In function siw_proc_send:
> ./include/linux/spinlock.h:288:3: warning: flags may be used uninitialized in this function [-Wmaybe-uninitialized]
>    _raw_spin_unlock_irqrestore(lock, flags); \
>    ^~~~~~~~~~~~~~~~~~~~~~~~~~~
> drivers/infiniband/sw/siw/siw_qp_rx.c:335:16: note: flags was declared here
>   unsigned long flags;
>
> Cc: Bernard Metzler <bmt@zurich.ibm.com>
> Cc: Doug Ledford <dledford@redhat.com>
> Cc: Jason Gunthorpe <jgg@ziepe.ca>
> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
> ---
>
>  drivers/infiniband/sw/siw/siw_qp_rx.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>

It is unclear to me how is that possible.

Thanks,
Reviewed-by: Leon Romanovsky <leonro@mellanox.com>
Jason Gunthorpe March 24, 2020, 10:51 p.m. UTC | #2
On Mon, Mar 23, 2020 at 11:46:27AM -0700, akpm@linux-foundation.org wrote:
> From: Andrew Morton <akpm@linux-foundation.org>
> Subject: drivers/infiniband/sw/siw/siw_qp_rx.c: suppress uninitialized var warning
> 
> drivers/infiniband/sw/siw/siw_qp_rx.c: In function siw_proc_send:
> ./include/linux/spinlock.h:288:3: warning: flags may be used uninitialized in this function [-Wmaybe-uninitialized]
>    _raw_spin_unlock_irqrestore(lock, flags); \
>    ^~~~~~~~~~~~~~~~~~~~~~~~~~~
> drivers/infiniband/sw/siw/siw_qp_rx.c:335:16: note: flags was declared here
>   unsigned long flags;
> 
> Cc: Bernard Metzler <bmt@zurich.ibm.com>
> Cc: Doug Ledford <dledford@redhat.com>
> Cc: Jason Gunthorpe <jgg@ziepe.ca>
> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
> ---
> 
>  drivers/infiniband/sw/siw/siw_qp_rx.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Applied to for-next, though I suppose gcc fixed this at some point as
I don't see the warning here...

Thanks,
Jason
diff mbox series

Patch

--- a/drivers/infiniband/sw/siw/siw_qp_rx.c~drivers-infiniband-sw-siw-siw_qp_rxc-suppress-uninitialized-var-warning
+++ a/drivers/infiniband/sw/siw/siw_qp_rx.c
@@ -332,7 +332,7 @@  static struct siw_wqe *siw_rqe_get(struc
 	struct siw_srq *srq;
 	struct siw_wqe *wqe = NULL;
 	bool srq_event = false;
-	unsigned long flags;
+	unsigned long uninitialized_var(flags);
 
 	srq = qp->srq;
 	if (srq) {