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

drm/vmwgfx: Replace unconditional mutex unlocked warnings with lockdep counterpart

Replace instances of WARN_ON[_ONCE](!mutex_is_held()) with
lockdep_assert_held(). This makes sure the checking process actually
holds the mutex and also removes the checks from release builds

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Sinclair Yeh <syeh@vmware.com>
Reviewed-by: Deepak Rawat <drawat@vmware.com>

+6 -6
+2 -2
drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c
··· 660 660 { 661 661 struct vmw_cmdbuf_header *cur = man->cur; 662 662 663 - WARN_ON(!mutex_is_locked(&man->cur_mutex)); 663 + lockdep_assert_held_once(&man->cur_mutex); 664 664 665 665 if (!cur) 666 666 return; ··· 1045 1045 { 1046 1046 struct vmw_cmdbuf_header *cur = man->cur; 1047 1047 1048 - WARN_ON(!mutex_is_locked(&man->cur_mutex)); 1048 + lockdep_assert_held_once(&man->cur_mutex); 1049 1049 1050 1050 WARN_ON(size > cur->reserved); 1051 1051 man->cur_pos += size;
+1 -1
drivers/gpu/drm/vmwgfx/vmwgfx_shader.c
··· 562 562 { 563 563 struct vmw_dx_shader *entry, *next; 564 564 565 - WARN_ON_ONCE(!mutex_is_locked(&dev_priv->binding_mutex)); 565 + lockdep_assert_held_once(&dev_priv->binding_mutex); 566 566 567 567 list_for_each_entry_safe(entry, next, list, cotable_head) { 568 568 WARN_ON(vmw_dx_shader_scrub(&entry->res));
+3 -3
drivers/gpu/drm/vmwgfx/vmwgfx_so.c
··· 208 208 union vmw_view_destroy body; 209 209 } *cmd; 210 210 211 - WARN_ON_ONCE(!mutex_is_locked(&dev_priv->binding_mutex)); 211 + lockdep_assert_held_once(&dev_priv->binding_mutex); 212 212 vmw_binding_res_list_scrub(&res->binding_head); 213 213 214 214 if (!view->committed || res->id == -1) ··· 439 439 { 440 440 struct vmw_view *entry, *next; 441 441 442 - WARN_ON_ONCE(!mutex_is_locked(&dev_priv->binding_mutex)); 442 + lockdep_assert_held_once(&dev_priv->binding_mutex); 443 443 444 444 list_for_each_entry_safe(entry, next, list, cotable_head) 445 445 WARN_ON(vmw_view_destroy(&entry->res)); ··· 459 459 { 460 460 struct vmw_view *entry, *next; 461 461 462 - WARN_ON_ONCE(!mutex_is_locked(&dev_priv->binding_mutex)); 462 + lockdep_assert_held_once(&dev_priv->binding_mutex); 463 463 464 464 list_for_each_entry_safe(entry, next, list, srf_head) 465 465 WARN_ON(vmw_view_destroy(&entry->res));