diff mbox series

[1/5] RDMA/ib_hdrs.h: Remove a superfluous cast

Message ID 20210512032752.16611-2-bvanassche@acm.org (mailing list archive)
State Superseded
Headers show
Series SRP kernel patches for kernel v5.14 | expand

Commit Message

Bart Van Assche May 12, 2021, 3:27 a.m. UTC
be16_to_cpu() returns a u16 value. Remove the superfluous u16 cast. That
cast was introduced by commit 7dafbab3753f ("IB/hfi1: Add functions to
parse BTH/IB headers").

Cc: Don Hiatt <don.hiatt@intel.com>
Cc: Dennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 include/rdma/ib_hdrs.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Leon Romanovsky May 19, 2021, 9 a.m. UTC | #1
On Tue, May 11, 2021 at 08:27:48PM -0700, Bart Van Assche wrote:
> be16_to_cpu() returns a u16 value. Remove the superfluous u16 cast. That
> cast was introduced by commit 7dafbab3753f ("IB/hfi1: Add functions to
> parse BTH/IB headers").
> 
> Cc: Don Hiatt <don.hiatt@intel.com>
> Cc: Dennis Dalessandro <dennis.dalessandro@intel.com>
> Signed-off-by: Bart Van Assche <bvanassche@acm.org>
> ---
>  include/rdma/ib_hdrs.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/include/rdma/ib_hdrs.h b/include/rdma/ib_hdrs.h
> index 57c1ac881d08..82483120539f 100644
> --- a/include/rdma/ib_hdrs.h
> +++ b/include/rdma/ib_hdrs.h
> @@ -208,7 +208,7 @@ static inline u8 ib_get_lver(struct ib_header *hdr)
>  
>  static inline u16 ib_get_len(struct ib_header *hdr)
>  {
> -	return (u16)(be16_to_cpu(hdr->lrh[2]));
> +	return be16_to_cpu(hdr->lrh[2]);
>  }
>  
>  static inline u32 ib_get_qkey(struct ib_other_headers *ohdr)

It is unclear why this function in the header. It is called only once.

Thanks,
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
Bart Van Assche May 24, 2021, 3:12 a.m. UTC | #2
On 5/19/21 2:00 AM, Leon Romanovsky wrote:
> On Tue, May 11, 2021 at 08:27:48PM -0700, Bart Van Assche wrote:
>> diff --git a/include/rdma/ib_hdrs.h b/include/rdma/ib_hdrs.h
>> index 57c1ac881d08..82483120539f 100644
>> --- a/include/rdma/ib_hdrs.h
>> +++ b/include/rdma/ib_hdrs.h
>> @@ -208,7 +208,7 @@ static inline u8 ib_get_lver(struct ib_header *hdr)
>>  
>>  static inline u16 ib_get_len(struct ib_header *hdr)
>>  {
>> -	return (u16)(be16_to_cpu(hdr->lrh[2]));
>> +	return be16_to_cpu(hdr->lrh[2]);
>>  }
>>  
>>  static inline u32 ib_get_qkey(struct ib_other_headers *ohdr)
> 
> It is unclear why this function in the header. It is called only once.

That's a good point. I will move it into the .c file that uses this
function.

Thanks,

Bart.
diff mbox series

Patch

diff --git a/include/rdma/ib_hdrs.h b/include/rdma/ib_hdrs.h
index 57c1ac881d08..82483120539f 100644
--- a/include/rdma/ib_hdrs.h
+++ b/include/rdma/ib_hdrs.h
@@ -208,7 +208,7 @@  static inline u8 ib_get_lver(struct ib_header *hdr)
 
 static inline u16 ib_get_len(struct ib_header *hdr)
 {
-	return (u16)(be16_to_cpu(hdr->lrh[2]));
+	return be16_to_cpu(hdr->lrh[2]);
 }
 
 static inline u32 ib_get_qkey(struct ib_other_headers *ohdr)