Re: drivers/nvdimm/pmem.c:48:20: error: conflicting types for 'to_phys'; have 'phys_addr_t(struct pmem_device *, phys_addr_t)' {aka 'long long unsigned int(struct pmem_device *, long long unsigned int)'}
From: Jane Chu
Date: Tue Jul 12 2022 - 19:33:28 EST
Apology for delayed reply, this issue has been fixed.
-jane
On 6/24/2022 7:58 PM, kernel test robot wrote:
> Hi Jane,
>
> FYI, the error/warning still remains.
>
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> head: 92f20ff72066d8d7e2ffb655c2236259ac9d1c5d
> commit: 9409c9b6709e59866ed3540b5d7f5291439e4833 pmem: refactor pmem_clear_poison()
> date: 6 weeks ago
> config: um-allmodconfig
> compiler: gcc-11 (Debian 11.3.0-3) 11.3.0
> reproduce (this is a W=1 build):
> # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=9409c9b6709e59866ed3540b5d7f5291439e4833
> git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
> git fetch --no-tags linus master
> git checkout 9409c9b6709e59866ed3540b5d7f5291439e4833
> # save the config file
> mkdir build_dir && cp config build_dir/.config
> make W=1 O=build_dir ARCH=um SHELL=/bin/bash
>
> If you fix the issue, kindly add following tag where applicable
> Reported-by: kernel test robot <lkp@xxxxxxxxx>
>
> All errors (new ones prefixed by >>):
>
>>> drivers/nvdimm/pmem.c:48:20: error: conflicting types for 'to_phys'; have 'phys_addr_t(struct pmem_device *, phys_addr_t)' {aka 'long long unsigned int(struct pmem_device *, long long unsigned int)'}
> 48 | static phys_addr_t to_phys(struct pmem_device *pmem, phys_addr_t offset)
> | ^~~~~~~
> In file included from arch/um/include/asm/page.h:98,
> from arch/um/include/asm/thread_info.h:15,
> from include/linux/thread_info.h:60,
> from include/asm-generic/preempt.h:5,
> from ./arch/um/include/generated/asm/preempt.h:1,
> from include/linux/preempt.h:78,
> from include/linux/spinlock.h:55,
> from include/linux/wait.h:9,
> from include/linux/wait_bit.h:8,
> from include/linux/fs.h:6,
> from include/linux/highmem.h:5,
> from include/linux/bvec.h:10,
> from include/linux/blk_types.h:10,
> from include/linux/blkdev.h:9,
> from drivers/nvdimm/pmem.c:10:
> arch/um/include/shared/mem.h:12:29: note: previous definition of 'to_phys' with type 'long unsigned int(void *)'
> 12 | static inline unsigned long to_phys(void *virt)
> | ^~~~~~~
> In file included from arch/um/include/asm/page.h:114,
> from arch/um/include/asm/thread_info.h:15,
> from include/linux/thread_info.h:60,
> from include/asm-generic/preempt.h:5,
> from ./arch/um/include/generated/asm/preempt.h:1,
> from include/linux/preempt.h:78,
> from include/linux/spinlock.h:55,
> from include/linux/wait.h:9,
> from include/linux/wait_bit.h:8,
> from include/linux/fs.h:6,
> from include/linux/highmem.h:5,
> from include/linux/bvec.h:10,
> from include/linux/blk_types.h:10,
> from include/linux/blkdev.h:9,
> from drivers/nvdimm/pmem.c:10:
> drivers/nvdimm/pmem.c: In function 'pmem_dax_zero_page_range':
>>> arch/um/include/asm/page.h:105:20: error: too few arguments to function 'to_phys'
> 105 | #define __pa(virt) to_phys((void *) (unsigned long) (virt))
> | ^~~~~~~
> include/asm-generic/memory_model.h:18:46: note: in definition of macro '__pfn_to_page'
> 18 | #define __pfn_to_page(pfn) (mem_map + ((pfn) - ARCH_PFN_OFFSET))
> | ^~~
> arch/um/include/asm/pgtable.h:276:40: note: in expansion of macro 'phys_to_pfn'
> 276 | #define phys_to_page(phys) pfn_to_page(phys_to_pfn(phys))
> | ^~~~~~~~~~~
> arch/um/include/asm/pgtable.h:277:30: note: in expansion of macro 'phys_to_page'
> 277 | #define __virt_to_page(virt) phys_to_page(__pa(virt))
> | ^~~~~~~~~~~~
> arch/um/include/asm/pgtable.h:277:43: note: in expansion of macro '__pa'
> 277 | #define __virt_to_page(virt) phys_to_page(__pa(virt))
> | ^~~~
> arch/um/include/asm/pgtable.h:279:28: note: in expansion of macro '__virt_to_page'
> 279 | #define virt_to_page(addr) __virt_to_page((const unsigned long) addr)
> | ^~~~~~~~~~~~~~
> arch/um/include/asm/pgtable.h:93:26: note: in expansion of macro 'virt_to_page'
> 93 | #define ZERO_PAGE(vaddr) virt_to_page(empty_zero_page)
> | ^~~~~~~~~~~~
> drivers/nvdimm/pmem.c:299:56: note: in expansion of macro 'ZERO_PAGE'
> 299 | return blk_status_to_errno(pmem_do_write(pmem, ZERO_PAGE(0), 0,
> | ^~~~~~~~~
> drivers/nvdimm/pmem.c:48:20: note: declared here
> 48 | static phys_addr_t to_phys(struct pmem_device *pmem, phys_addr_t offset)
> | ^~~~~~~
> drivers/nvdimm/pmem.c:302:1: error: control reaches end of non-void function [-Werror=return-type]
> 302 | }
> | ^
> cc1: some warnings being treated as errors
>
>
> vim +48 drivers/nvdimm/pmem.c
>
> 47
> > 48 static phys_addr_t to_phys(struct pmem_device *pmem, phys_addr_t offset)
> 49 {
> 50 return pmem->phys_addr + offset;
> 51 }
> 52
>