vboxvideo: Fix incorrect type in assignment sparse warning
PATCH 1/1 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.
--- drivers/staging/vboxvideo/vbox_fb.c | 2 +- drivers/staging/vboxvideo/vbox_main.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/staging/vboxvideo/vbox_fb.c +1 -1
@@ -170,7 +170,7 @@ static int vboxfb_create(struct drm_fb_helper *helper,drm_fb_helper_fill_var (info, &fbdev->helper, sizes->fb_width, sizes->fb_height); - info->screen_base = bo->kmap.virtual; + info->screen_base = (char __iomem *)bo->kmap.virtual; info->screen_size = size;#ifdef CONFIG_DRM_KMS_FB_HELPER
drivers/staging/vboxvideo/vbox_main.c +1 -1
@@ -61,7 +61,7 @@ void vbox_enable_accel(struct vbox_private *vbox)if (vbox->vbva_info[i].vbva)continue ; - vbva = (void *)vbox->vbva_buffers + i *VBVA_MIN_BUFFER_SIZE ; + vbva = (void __force *)vbox->vbva_buffers + i *VBVA_MIN_BUFFER_SIZE ;if (!vbva_enable (&vbox->vbva_info[i], vbox->guest_pool, vbva, i)) {/* very old host or driver error. */
--
2.13.6
PATCH 1/1 vboxvideo: Fix incorrect type in assignment sparse warning
Quoted 53 lines · Alexander Kapshuk
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 *virtualThe
vbox_bobuffer object kernel mapping is handled by a call tottm_bo_kmap()prior to the assignment ofbo->kmap.virtualtoinfo->screen_baseof type char __iomem*.
Castingbo->kmap.virtualto 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_buffersiomapping is handled by callingvbox_accel_init()fromvbox_hw_init().__forceattribute is used in assignment to vbva to fix the warning.Signed-off-by Alexander Kapshuk <[email protected]>--- drivers/staging/vboxvideo/vbox_fb.c | 2 +- drivers/staging/vboxvideo/vbox_main.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)drivers/staging/vboxvideo/vbox_fb.c +1
-1@@ -170,7 +170,7 @@ static int vboxfb_create(struct drm_fb_helper *helper,drm_fb_helper_fill_var (info, &fbdev->helper, sizes->fb_width, sizes->fb_height); - info->screen_base = bo->kmap.virtual; + info->screen_base = (char __iomem *)bo->kmap.virtual; info->screen_size = size;#ifdef CONFIG_DRM_KMS_FB_HELPER drivers/staging/vboxvideo/vbox_main.c +1
-2@@ -61,7 +61,7 @@ void vbox_enable_accel(struct vbox_private *vbox)if (vbox->vbva_info[i].vbva)continue ; - vbva = (void *)vbox->vbva_buffers + i *VBVA_MIN_BUFFER_SIZE ; + vbva = (void __force *)vbox->vbva_buffers + i *VBVA_MIN_BUFFER_SIZE ;if (!vbva_enable (&vbox->vbva_info[i], vbox->guest_pool, vbva, i)) {/* very old host or driver error. */ --
Quoted 2 lines
2.13.6
Ping.
Could someone please comment on the patch above?
Thanks.
Hi,
Quoted 35 lines · Alexander Kapshuk
Quoted 34 lines · Alexander Kapshuk
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 *virtualThe
vbox_bobuffer object kernel mapping is handled by a call tottm_bo_kmap()prior to the assignment ofbo->kmap.virtualtoinfo->screen_baseof type char __iomem*.
Castingbo->kmap.virtualto 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_buffersiomapping is handled by callingvbox_accel_init()fromvbox_hw_init().__forceattribute is used in assignment to vbva to fix the warning.Signed-off-by Alexander Kapshuk <[email protected]>--- drivers/staging/vboxvideo/vbox_fb.c | 2 +- drivers/staging/vboxvideo/vbox_main.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)drivers/staging/vboxvideo/vbox_fb.c +0
-0@@ -170,7 +170,7 @@ static int vboxfb_create(struct drm_fb_helper *helper,drm_fb_helper_fill_var (info, &fbdev->helper, sizes->fb_width, sizes->fb_height);
Quoted 5 lines
drivers/staging/vboxvideo/vbox_fb.c static int vboxfb_create(struct drm_fb_helper *helper, · line 176
Quoted 5 lines
drivers/staging/vboxvideo/vbox_fb.c +1
-1- info->screen_base = bo->kmap.virtual; + info->screen_base = (char __iomem *)bo->kmap.virtual; info->screen_size = size;#ifdef CONFIG_DRM_KMS_FB_HELPER
This fix looks good to me.
Quoted 8 lines
Quoted 8 lines
drivers/staging/vboxvideo/vbox_main.c +0
-0@@ -61,7 +61,7 @@ void vbox_enable_accel(struct vbox_private *vbox)if (vbox->vbva_info[i].vbva)continue ;
Quoted 5 lines
drivers/staging/vboxvideo/vbox_main.c void vbox_enable_accel(struct vbox_private *vbox) · line 67
Quoted 5 lines
drivers/staging/vboxvideo/vbox_main.c +1
-1- vbva = (void *)vbox->vbva_buffers + i *VBVA_MIN_BUFFER_SIZE ; + vbva = (void __force *)vbox->vbva_buffers + i *VBVA_MIN_BUFFER_SIZE ;if (!vbva_enable (&vbox->vbva_info[i], vbox->guest_pool, vbva, i)) {/* very old host or driver error. */
Hmm, isn't there a cleaner way to fix this ? Maybe make vbva_enable's argument (and the local vbva variable) of type u8 __iomem * too ?
Regards,
Hans
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel