[PATCH] drm/vmwgfx: fix spinlock initialization in vmw_driver_load()

Tetsuo Handa penguin-kernel at I-love.SAKURA.ne.jp
Sun Mar 21 14:56:49 UTC 2021


Since vmw_write() from vmw_detect_version() from vmw_driver_load() calls
spin_lock(&dev_priv->hw_lock), spin_lock_init(&dev_priv->hw_lock) has to
be called before vmw_detect_version() is called, or lockdep gets disabled.

  INFO: trying to register non-static key.
  the code is fine but needs lockdep annotation.
  turning off the locking correctness validator.

Signed-off-by: Tetsuo Handa <penguin-kernel at I-love.SAKURA.ne.jp>
Fixes: 8772c0bb58bbf98a ("drm/vmwgfx: Cleanup pci resource allocation")
---
 drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
index dd69b51c40e4..a8049092fb32 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
@@ -715,6 +715,7 @@ static int vmw_driver_load(struct vmw_private *dev_priv, u32 pci_id)
 	ret = vmw_setup_pci_resources(dev_priv, pci_id);
 	if (ret)
 		return ret;
+	spin_lock_init(&dev_priv->hw_lock);
 	ret = vmw_detect_version(dev_priv);
 	if (ret)
 		goto out_no_pci_or_version;
@@ -725,7 +726,6 @@ static int vmw_driver_load(struct vmw_private *dev_priv, u32 pci_id)
 	mutex_init(&dev_priv->global_kms_state_mutex);
 	ttm_lock_init(&dev_priv->reservation_sem);
 	spin_lock_init(&dev_priv->resource_lock);
-	spin_lock_init(&dev_priv->hw_lock);
 	spin_lock_init(&dev_priv->waiter_lock);
 	spin_lock_init(&dev_priv->cap_lock);
 	spin_lock_init(&dev_priv->cursor_lock);
-- 
2.18.4



More information about the dri-devel mailing list