Skip to contentSkip to conversation

drm/amdkfd: Remove negative check of uint variable

PATCH In review Oded Gabbay 2 participants 5 messages Jan 22, 2015

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/3 drm/amdkfd: Remove negative check of uint variable

---
 drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +1 -1
index a5c69e9..23a1e95 100644
@@ -587,7 +587,7 @@ static int allocate_sdma_queue(struct device_queue_manager *dqm,
 static void deallocate_sdma_queue(struct device_queue_manager *dqm,
 				unsigned int sdma_queue_id)
 {
-	if (sdma_queue_id < 0 || sdma_queue_id >= CIK_SDMA_QUEUES)
+	if (sdma_queue_id >= CIK_SDMA_QUEUES)
 		return;
 	set_bit(sdma_queue_id, (unsigned long *)&dqm->sdma_bitmap);
 }
Signature · 6 lines
1.9.1

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#1 lore raw

PATCH 2/3 drm/amdkfd: Add break at the end of case

---
 drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c | 3 +++
 drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue.c         | 3 +++
 2 files changed, 6 insertions(+)
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +3 -0
index 23a1e95..85387c8 100644
@@ -1114,8 +1114,11 @@ struct device_queue_manager *device_queue_manager_init(struct kfd_dev *dev)
 	switch (dev->device_info->asic_family) {
 	case CHIP_CARRIZO:
 		device_queue_manager_init_vi(&dqm->ops_asic_specific);
+		break;
+
 	case CHIP_KAVERI:
 		device_queue_manager_init_cik(&dqm->ops_asic_specific);
+		break;
 	}
 
 	if (dqm->ops.initialize(dqm) != 0) {
drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue.c +3 -0
index c04b1ac..e415a2a 100644
@@ -288,8 +288,11 @@ struct kernel_queue *kernel_queue_init(struct kfd_dev *dev,
 	switch (dev->device_info->asic_family) {
 	case CHIP_CARRIZO:
 		kernel_queue_init_vi(&kq->ops_asic_specific);
+		break;
+
 	case CHIP_KAVERI:
 		kernel_queue_init_cik(&kq->ops_asic_specific);
+		break;
 	}
 
 	if (kq->ops.initialize(kq, dev, type, KFD_KERNEL_QUEUE_SIZE) == false) {
Signature · 6 lines
1.9.1

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#2 lore raw

PATCH 3/3 drm/amdkfd: Handle case of invalid queue type

In reply to Oded Gabbay

This patch handles a case where amdkfd tries to destroy a queue but the queue type is invalid.
This case occurs in non-HWS path.

---
 drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +5 -0
index 85387c8..99e2dbb 100644
@@ -301,6 +301,11 @@ static int destroy_queue_nocpsch(struct device_queue_manager *dqm,
 		}
 		dqm->sdma_queue_count--;
 		deallocate_sdma_queue(dqm, q->sdma_id);
+	} else {
+		pr_debug("q->properties.type is invalid (%d)\n",
+				q->properties.type);
+		retval = -EINVAL;
+		goto out;
 	}
 
 	retval = mqd->destroy_mqd(mqd, q->mqd,
Signature · 6 lines
1.9.1

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#3 lore raw

RE: [PATCH 3/3] drm/amdkfd: Handle case of invalid queue type

Patches are Reviewed-by: Jammy Zhou <[email protected]>

Regards,
Jammy

-----Original Message-----
From: dri-devel [mailto:[email protected]] On Behalf Of Gabbay, Oded
Sent: Thursday, January 22, 2015 5:42 PM
To: [email protected]
Subject: [PATCH 3/3] drm/amdkfd: Handle case of invalid queue type

This patch handles a case where amdkfd tries to destroy a queue but the queue type is invalid. This case occurs in non-HWS path.

---
 drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +5 -0
index 85387c8..99e2dbb 100644
@@ -301,6 +301,11 @@ static int destroy_queue_nocpsch(struct device_queue_manager *dqm,
 		}
 		dqm->sdma_queue_count--;
 		deallocate_sdma_queue(dqm, q->sdma_id);
+	} else {
+		pr_debug("q->properties.type is invalid (%d)\n",
+				q->properties.type);
+		retval = -EINVAL;
+		goto out;
 	}
 
 	retval = mqd->destroy_mqd(mqd, q->mqd,

--
1.9.1

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

#4 lore raw

Re: [PATCH 3/3] drm/amdkfd: Handle case of invalid queue type

Quoted 5 lines · Jammy

Patches are Reviewed-by: Jammy Zhou <[email protected]>

Regards,
Jammy

Thanks!
Oded

Quoted 33 lines

-----Original Message-----
From: dri-devel [mailto:[email protected]] On Behalf Of Gabbay, Oded
Sent: Thursday, January 22, 2015 5:42 PM
To: [email protected]
Subject: [PATCH 3/3] drm/amdkfd: Handle case of invalid queue type

This patch handles a case where amdkfd tries to destroy a queue but the queue type is invalid. This case occurs in non-HWS path.

---
  drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c | 5 +++++
  1 file changed, 5 insertions(+)
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +5 -1
index 85387c8..99e2dbb 100644
@@ -301,6 +301,11 @@ static int destroy_queue_nocpsch(struct device_queue_manager *dqm,
  		}
  		dqm->sdma_queue_count--;
  		deallocate_sdma_queue(dqm, q->sdma_id);
+	} else {
+		pr_debug("q->properties.type is invalid (%d)\n",
+				q->properties.type);
+		retval = -EINVAL;
+		goto out;
  	}
 
  	retval = mqd->destroy_mqd(mqd, q->mqd,
--

1.9.1

Quoted 5 lines

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel