staging: vt6655: remove unnecessary type cast
PATCH 1/1 staging: vt6655: remove unnecessary type cast
Remove le64_to_cpu(), as the type is already u64, as reported by sparse:drivers/staging/vt6655/card.c:758:16: warning: cast to restricted __le64
--- drivers/staging/vt6655/card.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/vt6655/card.c +1 -1
@@ -755,7 +755,7 @@ u64 vt6655_get_current_tsf(struct vnt_private *priv)return 0 ; low =ioread32 (iobase +MAC_REG_TSFCNTR ); high =ioread32 (iobase +MAC_REG_TSFCNTR +4 ); -return le64_to_cpu (low + ((u64 )high <<32 )); +return low + ((u64 )high <<32 ); }/*
Signature · 1 line
2.25.1
This is not the correct subject. The le64_to_cpu() is not a decorative feature which can be added or removed without affecting functionality. This patch either fixes a bug or it introduces a bug.
Quoted 13 lines · Nam Cao
Remove
le64_to_cpu(), as the type is already u64, as reported by sparse:drivers/staging/vt6655/card.c:758:16: warning: cast to restricted__le64Signed-off-by Nam Cao <[email protected]>--- drivers/staging/vt6655/card.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/staging/vt6655/card.c +0
-0
drivers/staging/vt6655/card.c u64 vt6655_get_current_tsf(struct vnt_private *priv) · line 758
Quoted 5 lines
drivers/staging/vt6655/card.c +1
-1@@ -755,7 +755,7 @@ u64 vt6655_get_current_tsf(struct vnt_private *priv)return 0 ; low =ioread32 (iobase +MAC_REG_TSFCNTR ); high =ioread32 (iobase +MAC_REG_TSFCNTR +4 ); -return le64_to_cpu (low + ((u64 )high <<32 )); +return low + ((u64 )high <<32 );
I fee like the original code would have been more readable if it were written as:
return le64_to_cpu(((u64)high << 32) | low);
This seems like a correct way to combine two halves of a le64 value. So the original code looks correct and the patch introduces a bug.
regards,
dan carpenter
Yes, this patch is a mistake. I clarified that but I think my email got blocked because it's html.
Sorry for wasting your time.
Best regards,
Nam