drivers/gpu/drm/gma500/fbdev.c:245:9: sparse: sparse: incorrect type in argument 1 (different address spaces)
From: kernel test robot
Date: Tue May 16 2023 - 03:56:00 EST
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: f1fcbaa18b28dec10281551dfe6ed3a3ed80e3d6
commit: 8f1aaccb04b7cf63135f4e2748226dfa2fb01e3f drm/gma500: Implement client-based fbdev emulation
date: 8 weeks ago
config: i386-randconfig-s001-20230515 (https://download.01.org/0day-ci/archive/20230516/202305161516.nT7k9Ujh-lkp@xxxxxxxxx/config)
compiler: gcc-11 (Debian 11.3.0-12) 11.3.0
reproduce:
# apt-get install sparse
# sparse version: v0.6.4-39-gce1a6720-dirty
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=8f1aaccb04b7cf63135f4e2748226dfa2fb01e3f
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 8f1aaccb04b7cf63135f4e2748226dfa2fb01e3f
# save the config file
mkdir build_dir && cp config build_dir/.config
make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=i386 olddefconfig
make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=i386 SHELL=/bin/bash drivers/gpu/drm/gma500/ drivers/platform/x86/
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Link: https://lore.kernel.org/oe-kbuild-all/202305161516.nT7k9Ujh-lkp@xxxxxxxxx/
sparse warnings: (new ones prefixed by >>)
>> drivers/gpu/drm/gma500/fbdev.c:245:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const * @@ got char [noderef] __iomem *screen_base @@
drivers/gpu/drm/gma500/fbdev.c:245:9: sparse: expected void const *
drivers/gpu/drm/gma500/fbdev.c:245:9: sparse: got char [noderef] __iomem *screen_base
>> drivers/gpu/drm/gma500/fbdev.c:245:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const * @@ got char [noderef] __iomem *screen_base @@
drivers/gpu/drm/gma500/fbdev.c:245:9: sparse: expected void const *
drivers/gpu/drm/gma500/fbdev.c:245:9: sparse: got char [noderef] __iomem *screen_base
>> drivers/gpu/drm/gma500/fbdev.c:245:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void * @@ got char [noderef] __iomem *screen_base @@
drivers/gpu/drm/gma500/fbdev.c:245:9: sparse: expected void *
drivers/gpu/drm/gma500/fbdev.c:245:9: sparse: got char [noderef] __iomem *screen_base
vim +245 drivers/gpu/drm/gma500/fbdev.c
158
159 /*
160 * struct drm_fb_helper_funcs
161 */
162
163 static int psb_fbdev_fb_probe(struct drm_fb_helper *fb_helper,
164 struct drm_fb_helper_surface_size *sizes)
165 {
166 struct drm_device *dev = fb_helper->dev;
167 struct drm_psb_private *dev_priv = to_drm_psb_private(dev);
168 struct pci_dev *pdev = to_pci_dev(dev->dev);
169 struct fb_info *info;
170 struct drm_framebuffer *fb;
171 struct drm_mode_fb_cmd2 mode_cmd = { };
172 int size;
173 int ret;
174 struct psb_gem_object *backing;
175 struct drm_gem_object *obj;
176 u32 bpp, depth;
177
178 /* No 24-bit packed mode */
179 if (sizes->surface_bpp == 24) {
180 sizes->surface_bpp = 32;
181 sizes->surface_depth = 24;
182 }
183 bpp = sizes->surface_bpp;
184 depth = sizes->surface_depth;
185
186 /*
187 * If the mode does not fit in 32 bit then switch to 16 bit to get
188 * a console on full resolution. The X mode setting server will
189 * allocate its own 32-bit GEM framebuffer.
190 */
191 size = ALIGN(sizes->surface_width * DIV_ROUND_UP(bpp, 8), 64) *
192 sizes->surface_height;
193 size = ALIGN(size, PAGE_SIZE);
194
195 if (size > dev_priv->vram_stolen_size) {
196 sizes->surface_bpp = 16;
197 sizes->surface_depth = 16;
198 }
199 bpp = sizes->surface_bpp;
200 depth = sizes->surface_depth;
201
202 mode_cmd.width = sizes->surface_width;
203 mode_cmd.height = sizes->surface_height;
204 mode_cmd.pitches[0] = ALIGN(mode_cmd.width * DIV_ROUND_UP(bpp, 8), 64);
205 mode_cmd.pixel_format = drm_mode_legacy_fb_format(bpp, depth);
206
207 size = mode_cmd.pitches[0] * mode_cmd.height;
208 size = ALIGN(size, PAGE_SIZE);
209
210 /* Allocate the framebuffer in the GTT with stolen page backing */
211 backing = psb_gem_create(dev, size, "fb", true, PAGE_SIZE);
212 if (IS_ERR(backing))
213 return PTR_ERR(backing);
214 obj = &backing->base;
215
216 fb = psb_framebuffer_create(dev, &mode_cmd, obj);
217 if (IS_ERR(fb)) {
218 ret = PTR_ERR(fb);
219 goto err_drm_gem_object_put;
220 }
221
222 fb_helper->fb = fb;
223
224 info = drm_fb_helper_alloc_info(fb_helper);
225 if (IS_ERR(info)) {
226 ret = PTR_ERR(info);
227 goto err_drm_framebuffer_unregister_private;
228 }
229
230 info->fbops = &psb_fbdev_fb_ops;
231 info->flags = FBINFO_DEFAULT;
232 /* Accessed stolen memory directly */
233 info->screen_base = dev_priv->vram_addr + backing->offset;
234 info->screen_size = size;
235
236 drm_fb_helper_fill_info(info, fb_helper, sizes);
237
238 info->fix.smem_start = dev_priv->fb_base;
239 info->fix.smem_len = size;
240 info->fix.ywrapstep = 0;
241 info->fix.ypanstep = 0;
242 info->fix.mmio_start = pci_resource_start(pdev, 0);
243 info->fix.mmio_len = pci_resource_len(pdev, 0);
244
> 245 memset(info->screen_base, 0, info->screen_size);
246
247 /* Use default scratch pixmap (info->pixmap.flags = FB_PIXMAP_SYSTEM) */
248
249 dev_dbg(dev->dev, "allocated %dx%d fb\n", fb->width, fb->height);
250
251 return 0;
252
253 err_drm_framebuffer_unregister_private:
254 drm_framebuffer_unregister_private(fb);
255 fb->obj[0] = NULL;
256 drm_framebuffer_cleanup(fb);
257 kfree(fb);
258 err_drm_gem_object_put:
259 drm_gem_object_put(obj);
260 return ret;
261 }
262
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests