Skip to contentSkip to conversation

ufs/core: ufshcd: Conversion to bool not necessary

PATCH Applied Bragatheswaran Manickavel 3 participants 4 messages Oct 24, 2023 – Oct 25, 2023

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

PATCH 1/1 ufs/core: ufshcd: Conversion to bool not necessary

A logical evaluation already results in bool. There is no need for using a ternary operator based evaluation and bool conversion of the outcome.

Issue identified using boolconv.cocci Coccinelle semantic patch.

---
 drivers/ufs/core/ufshcd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/ufs/core/ufshcd.c +1 -1
index 406885671665..bbd8e83be6c6 100644
@@ -2406,7 +2406,7 @@ static inline bool ufshcd_ready_for_uic_cmd(struct ufs_hba *hba)
 	int ret = read_poll_timeout(ufshcd_readl, val, val & UIC_COMMAND_READY,
 				    500, UIC_CMD_TIMEOUT * 1000, false, hba,
 				    REG_CONTROLLER_STATUS);
-	return ret == 0 ? true : false;
+	return ret == 0;
 }
 
 /**
Signature · 1 line
2.34.1
reviewer Reviewed-by on v1 1/1
#1 lore raw
Quoted 15 lines · Bragatheswaran Manickavel

A logical evaluation already results in bool. There is no need for using a ternary operator based evaluation and bool conversion of the outcome.

Issue identified using boolconv.cocci Coccinelle semantic patch.

---
  drivers/ufs/core/ufshcd.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/ufs/core/ufshcd.c +0 -0
index 406885671665..bbd8e83be6c6 100644

drivers/ufs/core/ufshcd.c static inline bool ufshcd_ready_for_uic_cmd(struct ufs_hba *hba) · line 2410

Quoted 6 lines
drivers/ufs/core/ufshcd.c +1 -1
@@ -2406,7 +2406,7 @@ static inline bool ufshcd_ready_for_uic_cmd(struct ufs_hba *hba)
  	int ret = read_poll_timeout(ufshcd_readl, val, val & UIC_COMMAND_READY,
  				    500, UIC_CMD_TIMEOUT * 1000, false, hba,
  				    REG_CONTROLLER_STATUS);
-	return ret == 0 ? true : false;
+	return ret == 0;
  }
#2 lore raw
In reply to Bragatheswaran Manickavel

Bragatheswaran,

Quoted 3 lines

A logical evaluation already results in bool. There is no need for using a ternary operator based evaluation and bool conversion of the outcome.

Applied to 6.7/scsi-staging, thanks!

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering
#3 lore raw
Quoted 7 lines · Martin K. Petersen

Bragatheswaran,

Quoted 3 lines

A logical evaluation already results in bool. There is no need for using a ternary operator based evaluation and bool conversion of the outcome.

Applied to 6.7/scsi-staging, thanks!

Thanks Bart Van and Martin!