Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

vboxvideo: Fix incorrect type in assignment sparse warning

Sparse emitted the following warning:
../drivers/staging/vboxvideo/vbox_fb.c:173:27: warning: incorrect type in assignment (different address spaces)
../drivers/staging/vboxvideo/vbox_fb.c:173:27: expected char [noderef] <asn:2>*screen_base
../drivers/staging/vboxvideo/vbox_fb.c:173:27: got void *virtual

The vbox_bo buffer object kernel mapping is handled by a call
to ttm_bo_kmap() prior to the assignment of bo->kmap.virtual to
info->screen_base of type char __iomem*.
Casting bo->kmap.virtual to char __iomem* in this assignment fixes
the warning.

vboxvideo: Fix address space of expression removal sparse warning

Sparse emitted the following warning:
../drivers/staging/vboxvideo/vbox_main.c:64:25: warning: cast removes address space of expression

vbox->vbva_buffers iomapping is handled by calling vbox_accel_init()
from vbox_hw_init().
__force attribute is used in assignment to vbva to fix the warning.

Signed-off-by: Alexander Kapshuk <alexander.kapshuk@gmail.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Alexander Kapshuk and committed by
Greg Kroah-Hartman
21c0885f c3738b37

+2 -2
+1 -1
drivers/staging/vboxvideo/vbox_fb.c
··· 170 170 drm_fb_helper_fill_var(info, &fbdev->helper, sizes->fb_width, 171 171 sizes->fb_height); 172 172 173 - info->screen_base = bo->kmap.virtual; 173 + info->screen_base = (char __iomem *)bo->kmap.virtual; 174 174 info->screen_size = size; 175 175 176 176 #ifdef CONFIG_DRM_KMS_FB_HELPER
+1 -1
drivers/staging/vboxvideo/vbox_main.c
··· 61 61 if (vbox->vbva_info[i].vbva) 62 62 continue; 63 63 64 - vbva = (void *)vbox->vbva_buffers + i * VBVA_MIN_BUFFER_SIZE; 64 + vbva = (void __force *)vbox->vbva_buffers + i * VBVA_MIN_BUFFER_SIZE; 65 65 if (!vbva_enable(&vbox->vbva_info[i], 66 66 vbox->guest_pool, vbva, i)) { 67 67 /* very old host or driver error. */