drm/vmwgfx: Remove unnecessary NULL checks before kvfree()
Subsystems (3)
PATCH RESEND 1/1 drm/vmwgfx: Remove unnecessary NULL checks before kvfree()
Since kvfree() already checks if its argument is NULL, an additional check before calling kvfree() is unnecessary and can be removed.
Remove both and the following Coccinelle/coccicheck warnings reported by ifnullfree.cocci:
WARNING: NULL check before some freeing functions is not needed
WARNING: NULL check before some freeing functions is not needed
--- drivers/gpu/drm/vmwgfx/vmwgfx_blit.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/gpu/drm/vmwgfx/vmwgfx_blit.c +2 -4
@@ -635,10 +635,8 @@ int vmw_bo_cpu_blit(struct vmw_bo *vmw_dst,kunmap_atomic (d.src_addr);if (d.dst_addr)kunmap_atomic (d.dst_addr); -if (src_pages) -kvfree (src_pages); -if (dst_pages) -kvfree (dst_pages); +kvfree (src_pages); +kvfree (dst_pages);return ret; }
Signature · 1 line
2.46.2
Zack Rusin
maintainerQuoted 33 lines · Thorsten Blum
Since
kvfree()already checks if its argument is NULL, an additional check before callingkvfree()is unnecessary and can be removed.Remove both and the following Coccinelle/coccicheck warnings reported by
ifnullfree.cocci:WARNING: NULL check before some freeing functions is not needed
WARNING: NULL check before some freeing functions is not neededSigned-off-by Thorsten Blum <[email protected]>--- drivers/gpu/drm/vmwgfx/vmwgfx_blit.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)drivers/gpu/drm/vmwgfx/vmwgfx_blit.c +2
-5@@ -635,10 +635,8 @@ int vmw_bo_cpu_blit(struct vmw_bo *vmw_dst,kunmap_atomic (d.src_addr);if (d.dst_addr)kunmap_atomic (d.dst_addr); -if (src_pages) -kvfree (src_pages); -if (dst_pages) -kvfree (dst_pages); +kvfree (src_pages); +kvfree (dst_pages);return ret; } --
Quoted 2 lines
2.46.2
Thank you. Looks good. I went ahead and pushed it to drm-misc-fixes.
z