mm/memblock: remove redundant assignment to variable max_addr
diff mbox series

Message ID 20200228235003.112718-1-colin.king@canonical.com
State New
Headers show
Series
  • mm/memblock: remove redundant assignment to variable max_addr
Related show

Commit Message

Colin King Feb. 28, 2020, 11:50 p.m. UTC
From: Colin Ian King <colin.king@canonical.com>

The variable max_addr is being initialized with a value that is never
read and it is being updated later with a new value.  The initialization
is redundant and can be removed.

Addresses-Coverity: ("Unused value")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 mm/memblock.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Pankaj Gupta Feb. 29, 2020, 7:47 a.m. UTC | #1
>
> From: Colin Ian King <colin.king@canonical.com>
>
> The variable max_addr is being initialized with a value that is never
> read and it is being updated later with a new value.  The initialization
> is redundant and can be removed.
>
> Addresses-Coverity: ("Unused value")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  mm/memblock.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/mm/memblock.c b/mm/memblock.c
> index eba94ee3de0b..4d06bbaded0f 100644
> --- a/mm/memblock.c
> +++ b/mm/memblock.c
> @@ -1698,7 +1698,7 @@ static phys_addr_t __init_memblock __find_max_addr(phys_addr_t limit)
>
>  void __init memblock_enforce_memory_limit(phys_addr_t limit)
>  {
> -       phys_addr_t max_addr = PHYS_ADDR_MAX;
> +       phys_addr_t max_addr;
>
>         if (!limit)
>                 return;
> --
> 2.25.0

Reviewed-by: Pankaj Gupta <pankaj.gupta.linux@gmail.com>

>
>
Mike Rapoport March 1, 2020, 6:33 a.m. UTC | #2
On Fri, Feb 28, 2020 at 11:50:03PM +0000, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> The variable max_addr is being initialized with a value that is never
> read and it is being updated later with a new value.  The initialization
> is redundant and can be removed.
> 
> Addresses-Coverity: ("Unused value")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>

Reviewed-by: Mike Rapoport <rppt@linux.ibm.com>

> ---
>  mm/memblock.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/mm/memblock.c b/mm/memblock.c
> index eba94ee3de0b..4d06bbaded0f 100644
> --- a/mm/memblock.c
> +++ b/mm/memblock.c
> @@ -1698,7 +1698,7 @@ static phys_addr_t __init_memblock __find_max_addr(phys_addr_t limit)
>  
>  void __init memblock_enforce_memory_limit(phys_addr_t limit)
>  {
> -	phys_addr_t max_addr = PHYS_ADDR_MAX;
> +	phys_addr_t max_addr;
>  
>  	if (!limit)
>  		return;
> -- 
> 2.25.0
>

Patch
diff mbox series

diff --git a/mm/memblock.c b/mm/memblock.c
index eba94ee3de0b..4d06bbaded0f 100644
--- a/mm/memblock.c
+++ b/mm/memblock.c
@@ -1698,7 +1698,7 @@  static phys_addr_t __init_memblock __find_max_addr(phys_addr_t limit)
 
 void __init memblock_enforce_memory_limit(phys_addr_t limit)
 {
-	phys_addr_t max_addr = PHYS_ADDR_MAX;
+	phys_addr_t max_addr;
 
 	if (!limit)
 		return;