Skip to contentSkip to conversation

drivers/ata: remove redundant val variable

PATCH Applied [email protected] 2 participants 2 messages Jan 4, 2022 – Jan 5, 2022 libata

lore
Share & tools
lore
#0 lore raw

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

From: Minghao Chi <[email protected]>

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

---
 drivers/ata/pata_octeon_cf.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
drivers/ata/pata_octeon_cf.c +1 -5
index b5a3f710d76d..70f91800fe9e 100644
@@ -73,16 +73,12 @@ MODULE_PARM_DESC(enable_dma,
  */
 static unsigned int ns_to_tim_reg(unsigned int tim_mult, unsigned int nsecs)
 {
-	unsigned int val;
-
 	/*
 	 * Compute # of eclock periods to get desired duration in
 	 * nanoseconds.
 	 */
-	val = DIV_ROUND_UP(nsecs * (octeon_get_io_clock_rate() / 1000000),
+	return DIV_ROUND_UP(nsecs * (octeon_get_io_clock_rate() / 1000000),
 			  1000 * tim_mult);
-
-	return val;
 }
 
 static void octeon_cf_set_boot_reg_cfg(int cs, unsigned int multiplier)
Signature · 1 line
2.25.1
#1 lore raw
Quoted 24 lines · On 1/4/22 20:25, [email protected] wrote:

From: Minghao Chi <[email protected]>

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

---
 drivers/ata/pata_octeon_cf.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
drivers/ata/pata_octeon_cf.c +0 -2
index b5a3f710d76d..70f91800fe9e 100644
@@ -73,16 +73,12 @@ MODULE_PARM_DESC(enable_dma,
  */
 static unsigned int ns_to_tim_reg(unsigned int tim_mult, unsigned int nsecs)
 {
-	unsigned int val;
-
 	/*
 	 * Compute # of eclock periods to get desired duration in

drivers/ata/pata_octeon_cf.c MODULE_PARM_DESC(enable_dma, · line 84

Quoted 10 lines
drivers/ata/pata_octeon_cf.c +1 -3
 	 * nanoseconds.
 	 */
-	val = DIV_ROUND_UP(nsecs * (octeon_get_io_clock_rate() / 1000000),
+	return DIV_ROUND_UP(nsecs * (octeon_get_io_clock_rate() / 1000000),
 			  1000 * tim_mult);
-
-	return val;
 }
 
 static void octeon_cf_set_boot_reg_cfg(int cs, unsigned int multiplier)

Applied to for-5.17. Thanks.

Signature · 2 lines
Damien Le Moal
Western Digital Research