[PATCH] mm: use ERR_CAST() as a cleanup

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The ->page is the first and only member of the folio struct so this code
works fine.  However, if we use ERR_CAST() then it's clearer that
this is an error pointer.

Signed-off-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
---
This was introduced in 2020 in 539a3322f208 ("filemap: Add
read_cache_folio and read_mapping_folio").

 mm/filemap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/filemap.c b/mm/filemap.c
index 5603ced05fb7..54e9ebaf4e84 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -3768,7 +3768,7 @@ static struct page *do_read_cache_page(struct address_space *mapping,
 
 	folio = do_read_cache_folio(mapping, index, filler, file, gfp);
 	if (IS_ERR(folio))
-		return &folio->page;
+		return ERR_CAST(folio);
 	return folio_file_page(folio, index);
 }
 
-- 
2.43.0





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux