Skip to content

Commit

Permalink
drm/msm: Small submitqueue creation cleanup
Browse files Browse the repository at this point in the history
If we don't have a gpu, there is no need to create a submitqueue, which
lets us simplify the error handling and submitqueue creation.

Signed-off-by: Rob Clark <[email protected]>
Acked-by: Christian König <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Rob Clark <[email protected]>
  • Loading branch information
robclark committed Jul 28, 2021
1 parent 375f9a6 commit 86c2a0f
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions drivers/gpu/drm/msm/msm_submitqueue.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,22 +66,20 @@ int msm_submitqueue_create(struct drm_device *drm, struct msm_file_private *ctx,
if (!ctx)
return -ENODEV;

if (!priv->gpu)
return -ENODEV;

if (prio >= priv->gpu->nr_rings)
return -EINVAL;

queue = kzalloc(sizeof(*queue), GFP_KERNEL);

if (!queue)
return -ENOMEM;

kref_init(&queue->ref);
queue->flags = flags;

if (priv->gpu) {
if (prio >= priv->gpu->nr_rings) {
kfree(queue);
return -EINVAL;
}

queue->prio = prio;
}
queue->prio = prio;

write_lock(&ctx->queuelock);

Expand All @@ -107,12 +105,14 @@ int msm_submitqueue_init(struct drm_device *drm, struct msm_file_private *ctx)
struct msm_drm_private *priv = drm->dev_private;
int default_prio;

if (!priv->gpu)
return -ENODEV;

/*
* Select priority 2 as the "default priority" unless nr_rings is less
* than 2 and then pick the lowest priority
*/
default_prio = priv->gpu ?
clamp_t(uint32_t, 2, 0, priv->gpu->nr_rings - 1) : 0;
default_prio = clamp_t(uint32_t, 2, 0, priv->gpu->nr_rings - 1);

INIT_LIST_HEAD(&ctx->submitqueues);

Expand Down

0 comments on commit 86c2a0f

Please sign in to comment.