Re: [PATCH] driver core: platform: set numa_node before platform_add_device()

From: kernel test robot
Date: Wed Sep 13 2023 - 06:52:28 EST


Hi guojinhui.liam,

kernel test robot noticed the following build errors:

[auto build test ERROR on linus/master]
[also build test ERROR on v6.6-rc1 next-20230913]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/guojinhui-liam/driver-core-platform-set-numa_node-before-platform_add_device/20230912-151119
base: linus/master
patch link: https://lore.kernel.org/r/20230912070900.1862-1-guojinhui.liam%40bytedance.com
patch subject: [PATCH] driver core: platform: set numa_node before platform_add_device()
config: um-allyesconfig (https://download.01.org/0day-ci/archive/20230913/202309131848.CgiiHpZu-lkp@xxxxxxxxx/config)
compiler: clang version 14.0.6 (https://github.com/llvm/llvm-project.git f28c006a5895fc0e329fe15fead81e37457cb1d1)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20230913/202309131848.CgiiHpZu-lkp@xxxxxxxxx/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202309131848.CgiiHpZu-lkp@xxxxxxxxx/

All errors (new ones prefixed by >>):

In file included from drivers/base/platform.c:15:
In file included from include/linux/of_irq.h:7:
In file included from include/linux/irq.h:20:
In file included from include/linux/io.h:13:
In file included from arch/um/include/asm/io.h:24:
include/asm-generic/io.h:547:31: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
val = __raw_readb(PCI_IOBASE + addr);
~~~~~~~~~~ ^
include/asm-generic/io.h:560:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
val = __le16_to_cpu((__le16 __force)__raw_readw(PCI_IOBASE + addr));
~~~~~~~~~~ ^
include/uapi/linux/byteorder/little_endian.h:37:51: note: expanded from macro '__le16_to_cpu'
#define __le16_to_cpu(x) ((__force __u16)(__le16)(x))
^
In file included from drivers/base/platform.c:15:
In file included from include/linux/of_irq.h:7:
In file included from include/linux/irq.h:20:
In file included from include/linux/io.h:13:
In file included from arch/um/include/asm/io.h:24:
include/asm-generic/io.h:573:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
val = __le32_to_cpu((__le32 __force)__raw_readl(PCI_IOBASE + addr));
~~~~~~~~~~ ^
include/uapi/linux/byteorder/little_endian.h:35:51: note: expanded from macro '__le32_to_cpu'
#define __le32_to_cpu(x) ((__force __u32)(__le32)(x))
^
In file included from drivers/base/platform.c:15:
In file included from include/linux/of_irq.h:7:
In file included from include/linux/irq.h:20:
In file included from include/linux/io.h:13:
In file included from arch/um/include/asm/io.h:24:
include/asm-generic/io.h:584:33: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
__raw_writeb(value, PCI_IOBASE + addr);
~~~~~~~~~~ ^
include/asm-generic/io.h:594:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
__raw_writew((u16 __force)cpu_to_le16(value), PCI_IOBASE + addr);
~~~~~~~~~~ ^
include/asm-generic/io.h:604:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
__raw_writel((u32 __force)cpu_to_le32(value), PCI_IOBASE + addr);
~~~~~~~~~~ ^
include/asm-generic/io.h:692:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
readsb(PCI_IOBASE + addr, buffer, count);
~~~~~~~~~~ ^
include/asm-generic/io.h:700:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
readsw(PCI_IOBASE + addr, buffer, count);
~~~~~~~~~~ ^
include/asm-generic/io.h:708:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
readsl(PCI_IOBASE + addr, buffer, count);
~~~~~~~~~~ ^
include/asm-generic/io.h:717:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
writesb(PCI_IOBASE + addr, buffer, count);
~~~~~~~~~~ ^
include/asm-generic/io.h:726:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
writesw(PCI_IOBASE + addr, buffer, count);
~~~~~~~~~~ ^
include/asm-generic/io.h:735:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
writesl(PCI_IOBASE + addr, buffer, count);
~~~~~~~~~~ ^
>> drivers/base/platform.c:846:28: error: implicit declaration of function 'acpi_get_node' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
set_dev_node(&pdev->dev, acpi_get_node(adev->handle));
^
drivers/base/platform.c:846:28: note: did you mean 'acpi_get_name'?
include/acpi/acpixf.h:525:9: note: 'acpi_get_name' declared here
acpi_get_name(acpi_handle object, u32 name_type,
^
include/acpi/platform/aclinux.h:93:21: note: expanded from macro 'ACPI_EXTERNAL_RETURN_STATUS'
static ACPI_INLINE prototype {return(AE_NOT_CONFIGURED);}
^
drivers/base/platform.c:846:46: error: incomplete definition of type 'struct acpi_device'
set_dev_node(&pdev->dev, acpi_get_node(adev->handle));
~~~~^
include/linux/acpi.h:788:8: note: forward declaration of 'struct acpi_device'
struct acpi_device;
^
12 warnings and 2 errors generated.


vim +/acpi_get_node +846 drivers/base/platform.c

797
798 /**
799 * platform_device_register_full - add a platform-level device with
800 * resources and platform-specific data
801 *
802 * @pdevinfo: data used to create device
803 *
804 * Returns &struct platform_device pointer on success, or ERR_PTR() on error.
805 */
806 struct platform_device *platform_device_register_full(
807 const struct platform_device_info *pdevinfo)
808 {
809 int ret;
810 struct platform_device *pdev;
811 struct acpi_device *adev = to_acpi_device_node(pdevinfo->fwnode);
812
813 pdev = platform_device_alloc(pdevinfo->name, pdevinfo->id);
814 if (!pdev)
815 return ERR_PTR(-ENOMEM);
816
817 pdev->dev.parent = pdevinfo->parent;
818 pdev->dev.fwnode = pdevinfo->fwnode;
819 pdev->dev.of_node = of_node_get(to_of_node(pdev->dev.fwnode));
820 pdev->dev.of_node_reused = pdevinfo->of_node_reused;
821
822 if (pdevinfo->dma_mask) {
823 pdev->platform_dma_mask = pdevinfo->dma_mask;
824 pdev->dev.dma_mask = &pdev->platform_dma_mask;
825 pdev->dev.coherent_dma_mask = pdevinfo->dma_mask;
826 }
827
828 ret = platform_device_add_resources(pdev,
829 pdevinfo->res, pdevinfo->num_res);
830 if (ret)
831 goto err;
832
833 ret = platform_device_add_data(pdev,
834 pdevinfo->data, pdevinfo->size_data);
835 if (ret)
836 goto err;
837
838 if (pdevinfo->properties) {
839 ret = device_create_managed_software_node(&pdev->dev,
840 pdevinfo->properties, NULL);
841 if (ret)
842 goto err;
843 }
844
845 if (adev)
> 846 set_dev_node(&pdev->dev, acpi_get_node(adev->handle));
847
848 ret = platform_device_add(pdev);
849 if (ret) {
850 err:
851 ACPI_COMPANION_SET(&pdev->dev, NULL);
852 platform_device_put(pdev);
853 return ERR_PTR(ret);
854 }
855
856 return pdev;
857 }
858 EXPORT_SYMBOL_GPL(platform_device_register_full);
859

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki