2021-12-07 08:32:33

by CGEL

[permalink] [raw]
Subject: [PATCH] mm:remove unneeded variable

From: chiminghao <[email protected]>

return value form directly instead of
taking this in another redundant variable.

Reported-by: Zeal Robot <[email protected]>
Signed-off-by: chiminghao <[email protected]>
---
mm/truncate.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/mm/truncate.c b/mm/truncate.c
index cc83a3f7c1ad..41b8249b3b4a 100644
--- a/mm/truncate.c
+++ b/mm/truncate.c
@@ -205,7 +205,6 @@ static void truncate_cleanup_page(struct page *page)
static int
invalidate_complete_page(struct address_space *mapping, struct page *page)
{
- int ret;

if (page->mapping != mapping)
return 0;
@@ -213,9 +212,7 @@ invalidate_complete_page(struct address_space *mapping, struct page *page)
if (page_has_private(page) && !try_to_release_page(page, 0))
return 0;

- ret = remove_mapping(mapping, page);
-
- return ret;
+ return remove_mapping(mapping, page);
}

int truncate_inode_page(struct address_space *mapping, struct page *page)
--
2.25.1



2021-12-07 10:18:51

by David Hildenbrand

[permalink] [raw]
Subject: Re: [PATCH] mm:remove unneeded variable

On 07.12.21 09:32, [email protected] wrote:
> From: chiminghao <[email protected]>
>
> return value form directly instead of
> taking this in another redundant variable.
>
> Reported-by: Zeal Robot <[email protected]>
> Signed-off-by: chiminghao <[email protected]>
> ---
> mm/truncate.c | 5 +----
> 1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/mm/truncate.c b/mm/truncate.c
> index cc83a3f7c1ad..41b8249b3b4a 100644
> --- a/mm/truncate.c
> +++ b/mm/truncate.c
> @@ -205,7 +205,6 @@ static void truncate_cleanup_page(struct page *page)
> static int
> invalidate_complete_page(struct address_space *mapping, struct page *page)
> {
> - int ret;
>
> if (page->mapping != mapping)
> return 0;
> @@ -213,9 +212,7 @@ invalidate_complete_page(struct address_space *mapping, struct page *page)
> if (page_has_private(page) && !try_to_release_page(page, 0))
> return 0;
>
> - ret = remove_mapping(mapping, page);
> -
> - return ret;
> + return remove_mapping(mapping, page);
> }
>
> int truncate_inode_page(struct address_space *mapping, struct page *page)
>

Reviewed-by: David Hildenbrand <[email protected]>

--
Thanks,

David / dhildenb


2021-12-08 09:36:41

by Muchun Song

[permalink] [raw]
Subject: Re: [PATCH] mm:remove unneeded variable

On Tue, Dec 7, 2021 at 4:32 PM <[email protected]> wrote:
>
> From: chiminghao <[email protected]>
>
> return value form directly instead of
> taking this in another redundant variable.
>
> Reported-by: Zeal Robot <[email protected]>
> Signed-off-by: chiminghao <[email protected]>

Reviewed-by: Muchun Song <[email protected]>

Thanks.

2021-12-08 12:35:49

by Pankaj Gupta

[permalink] [raw]
Subject: Re: [PATCH] mm:remove unneeded variable

> return value form directly instead of
> taking this in another redundant variable.
>
> Reported-by: Zeal Robot <[email protected]>
> Signed-off-by: chiminghao <[email protected]>
> ---
> mm/truncate.c | 5 +----
> 1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/mm/truncate.c b/mm/truncate.c
> index cc83a3f7c1ad..41b8249b3b4a 100644
> --- a/mm/truncate.c
> +++ b/mm/truncate.c
> @@ -205,7 +205,6 @@ static void truncate_cleanup_page(struct page *page)
> static int
> invalidate_complete_page(struct address_space *mapping, struct page *page)
> {
> - int ret;
>
> if (page->mapping != mapping)
> return 0;
> @@ -213,9 +212,7 @@ invalidate_complete_page(struct address_space *mapping, struct page *page)
> if (page_has_private(page) && !try_to_release_page(page, 0))
> return 0;
>
> - ret = remove_mapping(mapping, page);
> -
> - return ret;
> + return remove_mapping(mapping, page);
> }
>
> int truncate_inode_page(struct address_space *mapping, struct page *page)

Reviewed-by: Pankaj Gupta <[email protected]>