Commit c5283723 authored by Lucas Stach's avatar Lucas Stach

drm/etnaviv: simplify submit_create

Use kzalloc so other code doesn't need to worry about uninitialized members.
Drop the non-standard GFP flags, as we really don't want to fail the submit
when under slight memory pressure. Remove one level of indentation by using
an early return if the allocation failed. Also remove the unused drm device
member.
Signed-off-by: default avatarLucas Stach <l.stach@pengutronix.de>
Reviewed-by: default avatarPhilipp Zabel <p.zabel@pengutronix.de>
parent b6d6223f
...@@ -101,7 +101,6 @@ struct etnaviv_gem_submit_bo { ...@@ -101,7 +101,6 @@ struct etnaviv_gem_submit_bo {
* lasts for the duration of the submit-ioctl. * lasts for the duration of the submit-ioctl.
*/ */
struct etnaviv_gem_submit { struct etnaviv_gem_submit {
struct drm_device *dev;
struct etnaviv_gpu *gpu; struct etnaviv_gpu *gpu;
struct ww_acquire_ctx ticket; struct ww_acquire_ctx ticket;
struct dma_fence *fence; struct dma_fence *fence;
......
...@@ -38,17 +38,13 @@ static struct etnaviv_gem_submit *submit_create(struct drm_device *dev, ...@@ -38,17 +38,13 @@ static struct etnaviv_gem_submit *submit_create(struct drm_device *dev,
struct etnaviv_gem_submit *submit; struct etnaviv_gem_submit *submit;
size_t sz = size_vstruct(nr, sizeof(submit->bos[0]), sizeof(*submit)); size_t sz = size_vstruct(nr, sizeof(submit->bos[0]), sizeof(*submit));
submit = kmalloc(sz, GFP_KERNEL | __GFP_NOWARN | __GFP_NORETRY); submit = kzalloc(sz, GFP_KERNEL);
if (submit) { if (!submit)
submit->dev = dev; return NULL;
submit->gpu = gpu;
/* initially, until copy_from_user() and bo lookup succeeds: */ submit->gpu = gpu;
submit->nr_bos = 0;
submit->fence = NULL;
ww_acquire_init(&submit->ticket, &reservation_ww_class); ww_acquire_init(&submit->ticket, &reservation_ww_class);
}
return submit; return submit;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment