All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg@nvidia.com>
To: Arnd Bergmann <arnd@kernel.org>
Cc: Doug Ledford <dledford@redhat.com>, Arnd Bergmann <arnd@arndb.de>,
	linux-rdma <linux-rdma@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] mthca: work around -Wenum-conversion warning
Date: Thu, 12 Nov 2020 12:46:21 -0400	[thread overview]
Message-ID: <20201112164621.GA917484@nvidia.com> (raw)
In-Reply-To: <CAK8P3a3Vq4K_pJWCEutvua5GijAL5mgzrCZC-sXWxz4MAOTThg@mail.gmail.com>

On Thu, Nov 12, 2020 at 05:45:00PM +0100, Arnd Bergmann wrote:
> On Thu, Nov 12, 2020 at 4:57 PM Jason Gunthorpe <jgg@nvidia.com> wrote:
> >
> > On Mon, Oct 26, 2020 at 10:12:30PM +0100, Arnd Bergmann wrote:
> > > 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
> > > +++ 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;
> >
> > This code is completely bogus, sigh
> >
> > Is this OK as far as the warning goes?
> 
> Yes, I'm sure your patch fixes it and it makes more sense than my version.
> 
> Acked-by: Arnd Bergmann <arnd@arndb.de>

Okay, I'll revise it, thanks

Jason

      reply	other threads:[~2020-11-12 16:46 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201112164621.GA917484@nvidia.com \
    --to=jgg@nvidia.com \
    --cc=arnd@arndb.de \
    --cc=arnd@kernel.org \
    --cc=dledford@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.