Skip to contentSkip to conversation

drivers/soundwire: remove redundant val variable

PATCH In review [email protected] 2 participants 2 messages Jan 10, 2022

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drivers/soundwire: remove redundant val variable

From: Minghao Chi <[email protected]>

Return value from SWRM_REG_VAL_PACK() directly instead of taking this in another redundant variable.

---
 drivers/soundwire/qcom.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/soundwire/qcom.c +1 -3
index 54813417ef8e..77f9c90370be 100644
@@ -235,7 +235,6 @@ static int qcom_swrm_cpu_reg_write(struct qcom_swrm_ctrl *ctrl, int reg,
 static u32 swrm_get_packed_reg_val(u8 *cmd_id, u8 cmd_data,
 				   u8 dev_addr, u16 reg_addr)
 {
-	u32 val;
 	u8 id = *cmd_id;
 
 	if (id != SWR_BROADCAST_CMD_ID) {
@@ -245,9 +244,8 @@ static u32 swrm_get_packed_reg_val(u8 *cmd_id, u8 cmd_data,
 			id = 0;
 		*cmd_id = id;
 	}
-	val = SWRM_REG_VAL_PACK(cmd_data, dev_addr, id, reg_addr);
 
-	return val;
+	return SWRM_REG_VAL_PACK(cmd_data, dev_addr, id, reg_addr);
 }
 
 static int swrm_wait_for_rd_fifo_avail(struct qcom_swrm_ctrl *swrm)
Signature · 1 line
2.25.1
#1 lore raw
Quoted 26 lines · On 2022-01-10 11:47 AM, [email protected] wrote:

From: Minghao Chi <[email protected]>

Return value from SWRM_REG_VAL_PACK() directly instead of taking this in another redundant variable.

---
  drivers/soundwire/qcom.c | 4 +---
  1 file changed, 1 insertion(+), 3 deletions(-)
drivers/soundwire/qcom.c +0 -1
index 54813417ef8e..77f9c90370be 100644
@@ -235,7 +235,6 @@ static int qcom_swrm_cpu_reg_write(struct qcom_swrm_ctrl *ctrl, int reg,
  static u32 swrm_get_packed_reg_val(u8 *cmd_id, u8 cmd_data,
  				   u8 dev_addr, u16 reg_addr)
  {
-	u32 val;
  	u8 id = *cmd_id;
 
  	if (id != SWR_BROADCAST_CMD_ID) {

drivers/soundwire/qcom.c static u32 swrm_get_packed_reg_val(u8 *cmd_id, u8 cmd_data, · line 251

Quoted 10 lines
drivers/soundwire/qcom.c +1 -2
@@ -245,9 +244,8 @@ static u32 swrm_get_packed_reg_val(u8 *cmd_id, u8 cmd_data,
  			id = 0;
  		*cmd_id = id;
  	}
-	val = SWRM_REG_VAL_PACK(cmd_data, dev_addr, id, reg_addr);
 
-	return val;
+	return SWRM_REG_VAL_PACK(cmd_data, dev_addr, id, reg_addr);
  }
 
  static int swrm_wait_for_rd_fifo_avail(struct qcom_swrm_ctrl *swrm)

Hello,

While the change looks good, the subject (commit title) seems off. Please take a look at commit titles found in drivers/soundwire, you'll find several good candidates there.

Regards,
Czarek