public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mthca: work around -Wenum-conversion warning
@ 2020-10-26 21:12 Arnd Bergmann
  2020-11-12 15:57 ` Jason Gunthorpe
  0 siblings, 1 reply; 4+ messages in thread
From: Arnd Bergmann @ 2020-10-26 21:12 UTC (permalink / raw)
  To: Doug Ledford, Jason Gunthorpe; +Cc: Arnd Bergmann, linux-rdma, linux-kernel

From: Arnd Bergmann <arnd@arndb.de>

gcc points out a suspicious mixing of enum types in a function that
converts from MTHCA_OPCODE_* values to IB_WC_* values:

drivers/infiniband/hw/mthca/mthca_cq.c: In function 'mthca_poll_one':
drivers/infiniband/hw/mthca/mthca_cq.c:607:21: warning: implicit conversion from 'enum <anonymous>' to 'enum ib_wc_opcode' [-Wenum-conversion]
  607 |    entry->opcode    = MTHCA_OPCODE_INVALID;

Nothing seems to ever check for MTHCA_OPCODE_INVALID again, no
idea if this is meaningful, but it seems harmless as it deals
with an invalid input.

Add a cast to suppress the warning.

Fixes: 2a4443a69934 ("[PATCH] IB/mthca: fill in opcode field for send completions")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/infiniband/hw/mthca/mthca_cq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/infiniband/hw/mthca/mthca_cq.c b/drivers/infiniband/hw/mthca/mthca_cq.c
index c3cfea243af8..319b8aa63f36 100644
--- a/drivers/infiniband/hw/mthca/mthca_cq.c
+++ b/drivers/infiniband/hw/mthca/mthca_cq.c
@@ -604,7 +604,7 @@ static inline int mthca_poll_one(struct mthca_dev *dev,
 			entry->byte_len  = MTHCA_ATOMIC_BYTE_LEN;
 			break;
 		default:
-			entry->opcode    = MTHCA_OPCODE_INVALID;
+			entry->opcode    = (u8)MTHCA_OPCODE_INVALID;
 			break;
 		}
 	} else {
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-11-12 16:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-10-26 21:12 [PATCH] mthca: work around -Wenum-conversion warning Arnd Bergmann
2020-11-12 15:57 ` Jason Gunthorpe
2020-11-12 16:45   ` Arnd Bergmann
2020-11-12 16:46     ` Jason Gunthorpe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox