All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drivers/ata: remove redundant val variable
@ 2022-01-04 11:25 cgel.zte
  2022-01-05  5:54 ` Damien Le Moal
  0 siblings, 1 reply; 2+ messages in thread
From: cgel.zte @ 2022-01-04 11:25 UTC (permalink / raw)
  To: damien.lemoal; +Cc: linux-ide, linux-kernel, Minghao Chi, Zeal Robot, CGEL ZTE

From: Minghao Chi <chi.minghao@zte.com.cn>

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

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Minghao Chi <chi.minghao@zte.com.cn>
Signed-off-by: CGEL ZTE <cgel.zte@gmail.com>
---
 drivers/ata/pata_octeon_cf.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/ata/pata_octeon_cf.c b/drivers/ata/pata_octeon_cf.c
index b5a3f710d76d..70f91800fe9e 100644
--- a/drivers/ata/pata_octeon_cf.c
+++ b/drivers/ata/pata_octeon_cf.c
@@ -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)
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] drivers/ata: remove redundant val variable
  2022-01-04 11:25 [PATCH] drivers/ata: remove redundant val variable cgel.zte
@ 2022-01-05  5:54 ` Damien Le Moal
  0 siblings, 0 replies; 2+ messages in thread
From: Damien Le Moal @ 2022-01-05  5:54 UTC (permalink / raw)
  To: cgel.zte; +Cc: linux-ide, linux-kernel, Minghao Chi, Zeal Robot

On 1/4/22 20:25, cgel.zte@gmail.com wrote:
> From: Minghao Chi <chi.minghao@zte.com.cn>
> 
> Return value from DIV_ROUND_UP() directly instead
> of taking this in another redundant variable.
> 
> Reported-by: Zeal Robot <zealci@zte.com.cn>
> Signed-off-by: Minghao Chi <chi.minghao@zte.com.cn>
> Signed-off-by: CGEL ZTE <cgel.zte@gmail.com>
> ---
>  drivers/ata/pata_octeon_cf.c | 6 +-----
>  1 file changed, 1 insertion(+), 5 deletions(-)
> 
> diff --git a/drivers/ata/pata_octeon_cf.c b/drivers/ata/pata_octeon_cf.c
> index b5a3f710d76d..70f91800fe9e 100644
> --- a/drivers/ata/pata_octeon_cf.c
> +++ b/drivers/ata/pata_octeon_cf.c
> @@ -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)

Applied to for-5.17. Thanks.

-- 
Damien Le Moal
Western Digital Research

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-01-05  5:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-04 11:25 [PATCH] drivers/ata: remove redundant val variable cgel.zte
2022-01-05  5:54 ` Damien Le Moal

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.