[PATCH 1/5] drm/crc: Allocate buffer before enabling crc generation

Mahesh Kumar mahesh1.kumar at intel.com
Mon Jun 18 14:02:51 UTC 2018


This patch make changes to allocate crc-entries buffer before
enabling CRC generation.

Signed-off-by: Mahesh Kumar <mahesh1.kumar at intel.com>
---
 drivers/gpu/drm/drm_debugfs_crc.c | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/drm_debugfs_crc.c b/drivers/gpu/drm/drm_debugfs_crc.c
index 9f8312137cad..5af6ae4f18b7 100644
--- a/drivers/gpu/drm/drm_debugfs_crc.c
+++ b/drivers/gpu/drm/drm_debugfs_crc.c
@@ -177,6 +177,16 @@ static int crtc_crc_open(struct inode *inode, struct file *filep)
 	if (ret)
 		return ret;
 
+	entries = kcalloc(DRM_CRC_ENTRIES_NR, sizeof(*entries), GFP_KERNEL);
+	if (!entries) {
+		ret = -ENOMEM;
+		goto err;
+	}
+
+	spin_lock_irq(&crc->lock);
+	crc->entries = entries;
+	spin_unlock_irq(&crc->lock);
+
 	ret = crtc->funcs->set_crc_source(crtc, crc->source, &values_cnt);
 	if (ret)
 		goto err;
@@ -191,14 +201,7 @@ static int crtc_crc_open(struct inode *inode, struct file *filep)
 		goto err_disable;
 	}
 
-	entries = kcalloc(DRM_CRC_ENTRIES_NR, sizeof(*entries), GFP_KERNEL);
-	if (!entries) {
-		ret = -ENOMEM;
-		goto err_disable;
-	}
-
 	spin_lock_irq(&crc->lock);
-	crc->entries = entries;
 	crc->values_cnt = values_cnt;
 
 	/*
-- 
2.16.2



More information about the Intel-gfx-trybot mailing list