drivers/gpu/drm/msm/msm_io_utils.c:65:31: sparse: sparse: incorrect type in return expression (different address spaces)

From: kernel test robot
Date: Tue Apr 05 2022 - 20:40:32 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 3123109284176b1532874591f7c81f3837bbdc17
commit: d89e5028346bd80f79c3073d132123e7a17e1177 drm/msm: move utility functions from msm_drv.c
date: 7 weeks ago
config: sparc64-randconfig-s031-20220405 (https://download.01.org/0day-ci/archive/20220405/202204052038.RxcTSgob-lkp@xxxxxxxxx/config)
compiler: sparc64-linux-gcc (GCC) 11.2.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# apt-get install sparse
# sparse version: v0.6.4-dirty
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=d89e5028346bd80f79c3073d132123e7a17e1177
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout d89e5028346bd80f79c3073d132123e7a17e1177
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=sparc64 SHELL=/bin/bash drivers/gpu/drm/msm/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>


sparse warnings: (new ones prefixed by >>)
>> drivers/gpu/drm/msm/msm_io_utils.c:65:31: sparse: sparse: incorrect type in return expression (different address spaces) @@ expected void [noderef] __iomem * @@ got void * @@
drivers/gpu/drm/msm/msm_io_utils.c:65:31: sparse: expected void [noderef] __iomem *
drivers/gpu/drm/msm/msm_io_utils.c:65:31: sparse: got void *
drivers/gpu/drm/msm/msm_io_utils.c:74:31: sparse: sparse: incorrect type in return expression (different address spaces) @@ expected void [noderef] __iomem * @@ got void * @@
drivers/gpu/drm/msm/msm_io_utils.c:74:31: sparse: expected void [noderef] __iomem *
drivers/gpu/drm/msm/msm_io_utils.c:74:31: sparse: got void *

vim +65 drivers/gpu/drm/msm/msm_io_utils.c

49
50 static void __iomem *_msm_ioremap(struct platform_device *pdev, const char *name,
51 bool quiet, phys_addr_t *psize)
52 {
53 struct resource *res;
54 unsigned long size;
55 void __iomem *ptr;
56
57 if (name)
58 res = platform_get_resource_byname(pdev, IORESOURCE_MEM, name);
59 else
60 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
61
62 if (!res) {
63 if (!quiet)
64 DRM_DEV_ERROR(&pdev->dev, "failed to get memory resource: %s\n", name);
> 65 return ERR_PTR(-EINVAL);
66 }
67
68 size = resource_size(res);
69
70 ptr = devm_ioremap(&pdev->dev, res->start, size);
71 if (!ptr) {
72 if (!quiet)
73 DRM_DEV_ERROR(&pdev->dev, "failed to ioremap: %s\n", name);
74 return ERR_PTR(-ENOMEM);
75 }
76
77 if (psize)
78 *psize = size;
79
80 return ptr;
81 }
82

--
0-DAY CI Kernel Test Service
https://01.org/lkp