2020-02-28 23:51:58

by Colin King

[permalink] [raw]
Subject: [PATCH] mm/memblock: remove redundant assignment to variable max_addr

From: Colin Ian King <[email protected]>

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 <[email protected]>
---
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


2020-02-29 07:48:04

by Pankaj Gupta

[permalink] [raw]
Subject: Re: [PATCH] mm/memblock: remove redundant assignment to variable max_addr

>
> From: Colin Ian King <[email protected]>
>
> 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 <[email protected]>
> ---
> 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 <[email protected]>

>
>

2020-03-01 06:33:42

by Mike Rapoport

[permalink] [raw]
Subject: Re: [PATCH] mm/memblock: remove redundant assignment to variable max_addr

On Fri, Feb 28, 2020 at 11:50:03PM +0000, Colin King wrote:
> From: Colin Ian King <[email protected]>
>
> 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 <[email protected]>

Reviewed-by: Mike Rapoport <[email protected]>

> ---
> 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
>

--
Sincerely yours,
Mike.