linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] IB/hfi1: Add explicit cast OPA_MTU_8192 to 'enum ib_mtu'
@ 2020-06-23  0:52 Nathan Chancellor
  2020-06-24 18:22 ` Dennis Dalessandro
  2020-07-02 14:26 ` Jason Gunthorpe
  0 siblings, 2 replies; 4+ messages in thread
From: Nathan Chancellor @ 2020-06-23  0:52 UTC (permalink / raw)
  To: Mike Marciniszyn, Dennis Dalessandro, Doug Ledford, Jason Gunthorpe
  Cc: linux-rdma, linux-kernel, clang-built-linux, Nathan Chancellor

Clang warns:

drivers/infiniband/hw/hfi1/qp.c:198:9: warning: implicit conversion from
enumeration type 'enum opa_mtu' to different enumeration type 'enum
ib_mtu' [-Wenum-conversion]
                mtu = OPA_MTU_8192;
                    ~ ^~~~~~~~~~~~
1 warning generated.

enum opa_mtu extends enum ib_mtu. There are typically two ways to deal
with this:

* Remove the expected types and just use 'int' for all parameters and
  types.

* Explicitly cast the enums between each other.

This driver chooses to do the later so do the same thing here.

Fixes: 6d72344cf6c4 ("IB/ipoib: Increase ipoib Datagram mode MTU's upper limit")
Link: https://github.com/ClangBuiltLinux/linux/issues/1062
Link: https://lore.kernel.org/linux-rdma/20200527040350.GA3118979@ubuntu-s3-xlarge-x86/
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
---
 drivers/infiniband/hw/hfi1/qp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/infiniband/hw/hfi1/qp.c b/drivers/infiniband/hw/hfi1/qp.c
index 0c2ae9f7b3e8..2f3d9ce077d3 100644
--- a/drivers/infiniband/hw/hfi1/qp.c
+++ b/drivers/infiniband/hw/hfi1/qp.c
@@ -195,7 +195,7 @@ static inline int verbs_mtu_enum_to_int(struct ib_device *dev, enum ib_mtu mtu)
 {
 	/* Constraining 10KB packets to 8KB packets */
 	if (mtu == (enum ib_mtu)OPA_MTU_10240)
-		mtu = OPA_MTU_8192;
+		mtu = (enum ib_mtu)OPA_MTU_8192;
 	return opa_mtu_enum_to_int((enum opa_mtu)mtu);
 }
 

base-commit: 27f11fea33608cbd321a97cbecfa2ef97dcc1821
-- 
2.27.0


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

* Re: [PATCH] IB/hfi1: Add explicit cast OPA_MTU_8192 to 'enum ib_mtu'
  2020-06-23  0:52 [PATCH] IB/hfi1: Add explicit cast OPA_MTU_8192 to 'enum ib_mtu' Nathan Chancellor
@ 2020-06-24 18:22 ` Dennis Dalessandro
  2020-06-30 21:05   ` Nathan Chancellor
  2020-07-02 14:26 ` Jason Gunthorpe
  1 sibling, 1 reply; 4+ messages in thread
From: Dennis Dalessandro @ 2020-06-24 18:22 UTC (permalink / raw)
  To: Nathan Chancellor, Mike Marciniszyn, Doug Ledford, Jason Gunthorpe
  Cc: linux-rdma, linux-kernel, clang-built-linux

On 6/22/2020 8:52 PM, Nathan Chancellor wrote:
> Clang warns:
> 
> drivers/infiniband/hw/hfi1/qp.c:198:9: warning: implicit conversion from
> enumeration type 'enum opa_mtu' to different enumeration type 'enum
> ib_mtu' [-Wenum-conversion]
>                  mtu = OPA_MTU_8192;
>                      ~ ^~~~~~~~~~~~
> 1 warning generated.
> 
> enum opa_mtu extends enum ib_mtu. There are typically two ways to deal
> with this:
> 
> * Remove the expected types and just use 'int' for all parameters and
>    types.
> 
> * Explicitly cast the enums between each other.
> 
> This driver chooses to do the later so do the same thing here.
> 
> Fixes: 6d72344cf6c4 ("IB/ipoib: Increase ipoib Datagram mode MTU's upper limit")
> Link: https://github.com/ClangBuiltLinux/linux/issues/1062
> Link: https://lore.kernel.org/linux-rdma/20200527040350.GA3118979@ubuntu-s3-xlarge-x86/
> Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
> ---

Acked-by: Dennis Dalessandro <dennis.dalessandro@intel.com>


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

* Re: [PATCH] IB/hfi1: Add explicit cast OPA_MTU_8192 to 'enum ib_mtu'
  2020-06-24 18:22 ` Dennis Dalessandro
@ 2020-06-30 21:05   ` Nathan Chancellor
  0 siblings, 0 replies; 4+ messages in thread
From: Nathan Chancellor @ 2020-06-30 21:05 UTC (permalink / raw)
  To: Dennis Dalessandro
  Cc: Mike Marciniszyn, Doug Ledford, Jason Gunthorpe, linux-rdma,
	linux-kernel, clang-built-linux

On Wed, Jun 24, 2020 at 02:22:08PM -0400, Dennis Dalessandro wrote:
> On 6/22/2020 8:52 PM, Nathan Chancellor wrote:
> > Clang warns:
> > 
> > drivers/infiniband/hw/hfi1/qp.c:198:9: warning: implicit conversion from
> > enumeration type 'enum opa_mtu' to different enumeration type 'enum
> > ib_mtu' [-Wenum-conversion]
> >                  mtu = OPA_MTU_8192;
> >                      ~ ^~~~~~~~~~~~
> > 1 warning generated.
> > 
> > enum opa_mtu extends enum ib_mtu. There are typically two ways to deal
> > with this:
> > 
> > * Remove the expected types and just use 'int' for all parameters and
> >    types.
> > 
> > * Explicitly cast the enums between each other.
> > 
> > This driver chooses to do the later so do the same thing here.
> > 
> > Fixes: 6d72344cf6c4 ("IB/ipoib: Increase ipoib Datagram mode MTU's upper limit")
> > Link: https://github.com/ClangBuiltLinux/linux/issues/1062
> > Link: https://lore.kernel.org/linux-rdma/20200527040350.GA3118979@ubuntu-s3-xlarge-x86/
> > Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
> > ---
> 
> Acked-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
> 

Thanks! Who should pick up this patch? This warning is in mainline now,
it would be nice if this could go via an -rc branch but if it is too
late for that, I understand.

Cheers,
Nathan

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

* Re: [PATCH] IB/hfi1: Add explicit cast OPA_MTU_8192 to 'enum ib_mtu'
  2020-06-23  0:52 [PATCH] IB/hfi1: Add explicit cast OPA_MTU_8192 to 'enum ib_mtu' Nathan Chancellor
  2020-06-24 18:22 ` Dennis Dalessandro
@ 2020-07-02 14:26 ` Jason Gunthorpe
  1 sibling, 0 replies; 4+ messages in thread
From: Jason Gunthorpe @ 2020-07-02 14:26 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: Mike Marciniszyn, Dennis Dalessandro, Doug Ledford, linux-rdma,
	linux-kernel, clang-built-linux

On Mon, Jun 22, 2020 at 05:52:24PM -0700, Nathan Chancellor wrote:
> Clang warns:
> 
> drivers/infiniband/hw/hfi1/qp.c:198:9: warning: implicit conversion from
> enumeration type 'enum opa_mtu' to different enumeration type 'enum
> ib_mtu' [-Wenum-conversion]
>                 mtu = OPA_MTU_8192;
>                     ~ ^~~~~~~~~~~~
> 1 warning generated.
> 
> enum opa_mtu extends enum ib_mtu. There are typically two ways to deal
> with this:
> 
> * Remove the expected types and just use 'int' for all parameters and
>   types.
> 
> * Explicitly cast the enums between each other.
> 
> This driver chooses to do the later so do the same thing here.
> 
> Fixes: 6d72344cf6c4 ("IB/ipoib: Increase ipoib Datagram mode MTU's upper limit")
> Link: https://github.com/ClangBuiltLinux/linux/issues/1062
> Link: https://lore.kernel.org/linux-rdma/20200527040350.GA3118979@ubuntu-s3-xlarge-x86/
> Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
> Acked-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
> ---
>  drivers/infiniband/hw/hfi1/qp.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Applied to for-rc, thanks

Jason

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

end of thread, other threads:[~2020-07-02 14:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-23  0:52 [PATCH] IB/hfi1: Add explicit cast OPA_MTU_8192 to 'enum ib_mtu' Nathan Chancellor
2020-06-24 18:22 ` Dennis Dalessandro
2020-06-30 21:05   ` Nathan Chancellor
2020-07-02 14:26 ` Jason Gunthorpe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).