Skip to contentSkip to conversation

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

PATCH Applied [email protected] 3 participants 3 messages Mar 23, 2020 – Mar 24, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

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

From: Andrew Morton <[email protected]>
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 <[email protected]>
Cc Doug Ledford <[email protected]>
Cc Jason Gunthorpe <[email protected]>

---

 drivers/infiniband/sw/siw/siw_qp_rx.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/sw/siw/siw_qp_rx.c renamed from drivers/infiniband/sw/siw/siw_qp_rx.c~drivers-infiniband-sw-siw-siw_qp_rxc-suppress-uninitialized-var-warning +1 -1
@@ -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) {

_

Reviewed-by on v1 1/1
#1 lore raw
Quoted 10 lines · On Mon, Mar 23, 2020 at 11:46:27AM -0700, [email protected] wrote:

From: Andrew Morton <[email protected]>
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;

Quoted 9 lines
Cc Bernard Metzler <[email protected]>
Cc Doug Ledford <[email protected]>
Cc Jason Gunthorpe <[email protected]>

---

 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,

#2 lore raw
In reply to [email protected]
Quoted 10 lines · On Mon, Mar 23, 2020 at 11:46:27AM -0700, [email protected] wrote:

From: Andrew Morton <[email protected]>
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;

Quoted 8 lines
Cc Bernard Metzler <[email protected]>
Cc Doug Ledford <[email protected]>
Cc Jason Gunthorpe <[email protected]>

---

 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