On Wed, Sep 27, 2023 at 10:40:21AM +0300, Dan Carpenter wrote: > The patch a3c38500d469: "buffer: hoist GFP flags from grow_dev_page() > to __getblk_gfp()" from Sep 14, 2023 (linux-next), leads to the > following Smatch static checker warning: > > fs/buffer.c:1065 grow_dev_page() > warn: NEW missing error code 'ret' Smatch is right. > fs/buffer.c > 1037 static int > 1038 grow_dev_page(struct block_device *bdev, sector_t block, > 1039 pgoff_t index, int size, int sizebits, gfp_t gfp) > 1040 { > 1041 struct inode *inode = bdev->bd_inode; > 1042 struct folio *folio; > 1043 struct buffer_head *bh; > 1044 sector_t end_block; > 1045 int ret = 0; > 1046 > 1047 folio = __filemap_get_folio(inode->i_mapping, index, > 1048 FGP_LOCK | FGP_ACCESSED | FGP_CREAT, gfp); > 1049 if (IS_ERR(folio)) > 1050 return PTR_ERR(folio); > 1051 > 1052 bh = folio_buffers(folio); > 1053 if (bh) { > 1054 if (bh->b_size == size) { > 1055 end_block = folio_init_buffers(folio, bdev, > 1056 (sector_t)index << sizebits, size); > 1057 goto done; > 1058 } > 1059 if (!try_to_free_buffers(folio)) > 1060 goto failed; > 1061 } > 1062 > 1063 bh = folio_alloc_buffers(folio, size, gfp | __GFP_ACCOUNT); > 1064 if (!bh) > --> 1065 goto failed; > > Should this be an error code? It's kind of complicated because I think > the other goto failed path deliberately returns zero? Yes, it's very confusing. Which is a common refrain in this part of the VFS. Thanks for the report, I'll sort it out.