[PATCH 10/12] drm/amdkfd: remove dead code in kq_initialize

Felix Kuehling felix.kuehling at amd.com
Tue Jun 4 18:44:33 UTC 2024


On 2024-06-03 04:49, Jesse Zhang wrote:
> The queue type can only be KFD_QUEUE_TYPE_DIQ or KFD_QUEUE_TYPE_HIQ,
> and the default cannot be reached.

I wonder, if you remove the default case, I guess you are relying on the 
compiler or a static checker to ensure that we can only pass valid enum 
values to this function. I don't think C compilers are that strict. You 
could pass a random integer to the function. That said, this function 
only has two callers, and both of them use a proper enum value.


>
> Signed-off-by: Jesse Zhang <Jesse.Zhang at amd.com>

Acked-by: Felix Kuehling <felix.kuehling at amd.com>


> ---
>   drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue.c | 3 ---
>   1 file changed, 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue.c b/drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue.c
> index 32c926986dbb..3142b2593e2b 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue.c
> @@ -67,9 +67,6 @@ static bool kq_initialize(struct kernel_queue *kq, struct kfd_node *dev,
>   	case KFD_QUEUE_TYPE_HIQ:
>   		kq->mqd_mgr = dev->dqm->mqd_mgrs[KFD_MQD_TYPE_HIQ];
>   		break;
> -	default:
> -		pr_err("Invalid queue type %d\n", type);
> -		return false;
>   	}
>   
>   	if (!kq->mqd_mgr)


More information about the amd-gfx mailing list