Skip to contentSkip to conversation

Staging: rts5208: Fix incorrect type in assignment

PATCH In review Vatika Harlalka 2 participants 3 messages Mar 21, 2015 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Staging: rts5208: Fix incorrect type in assignment

Fix incorrect type in assignment.

---
 drivers/staging/rts5208/rtsx_transport.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/rts5208/rtsx_transport.c +2 -2
index 03caa9b..2cd03d7 100644
@@ -218,7 +218,7 @@ void rtsx_add_cmd(struct rtsx_chip *chip,
 
 	spin_lock_irq(&chip->rtsx->reg_lock);
 	if (chip->ci < (HOST_CMDS_BUF_LEN / 4))
-		cb[(chip->ci)++] = cpu_to_le32(val);
+		cb[(chip->ci)++] = val;
 
 	spin_unlock_irq(&chip->rtsx->reg_lock);
 }
@@ -316,7 +316,7 @@ static inline void rtsx_add_sg_tbl(
 		val = ((u64)addr << 32) | ((u64)temp_len << 12) | temp_opt;
 
 		if (chip->sgi < (HOST_SG_TBL_BUF_LEN / 8))
-			sgb[(chip->sgi)++] = cpu_to_le64(val);
+			sgb[(chip->sgi)++] = val;
 
 		len -= temp_len;
 		addr += temp_len;
Signature · 1 line
1.9.1
#1 lore raw
Quoted 1 line · Vatika Harlalka

Fix incorrect type in assignment.

Explain more.

julia

Quoted 38 lines
---
 drivers/staging/rts5208/rtsx_transport.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/rts5208/rtsx_transport.c +2 -2
index 03caa9b..2cd03d7 100644
@@ -218,7 +218,7 @@ void rtsx_add_cmd(struct rtsx_chip *chip,
 
 	spin_lock_irq(&chip->rtsx->reg_lock);
 	if (chip->ci < (HOST_CMDS_BUF_LEN / 4))
-		cb[(chip->ci)++] = cpu_to_le32(val);
+		cb[(chip->ci)++] = val;
 
 	spin_unlock_irq(&chip->rtsx->reg_lock);
 }
@@ -316,7 +316,7 @@ static inline void rtsx_add_sg_tbl(
 		val = ((u64)addr << 32) | ((u64)temp_len << 12) | temp_opt;
 
 		if (chip->sgi < (HOST_SG_TBL_BUF_LEN / 8))
-			sgb[(chip->sgi)++] = cpu_to_le64(val);
+			sgb[(chip->sgi)++] = val;
 
 		len -= temp_len;
 		addr += temp_len;
Signature · 8 lines
1.9.1

-- 
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20150321082830.GA20169%40akanksha.
For more options, visit https://groups.google.com/d/optout.
#2 lore raw
Quoted 4 lines

- cb[(chip->ci)++] = cpu_to_le32(val);

Quoted 1 line

+ cb[(chip->ci)++] = val;

For this case, we don't need to cast u32 to __le32 as cb is declared as u32 *

Quoted 3 lines

drivers/staging/rts5208/rtsx_transport.c static inline void rtsx_add_sg_tbl( · line 319

Quoted 2 lines
drivers/staging/rts5208/rtsx_transport.c +1 -1
-                     sgb[(chip->sgi)++] = cpu_to_le64(val);
+                     sgb[(chip->sgi)++] = val;

For this case, we don't need to cast u64 to __le64 as sgb is declared as u64*

These were detected with sparse.
This is my understanding, please offer suggestions if that is not the case :)