diff options
author | Lucas Stach <l.stach@pengutronix.de> | 2017-11-24 10:43:07 +0100 |
---|---|---|
committer | Lucas Stach <l.stach@pengutronix.de> | 2018-01-02 17:26:59 +0100 |
commit | c52837238038f61b6511eadee94fcab622d635f0 (patch) | |
tree | e397a964ff50688f22549599ec3385a9444be57b /drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c | |
parent | b6d6223f5029d3c4fe466ce1711fe4cb23d06013 (diff) | |
download | linux-c52837238038f61b6511eadee94fcab622d635f0.tar.bz2 |
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: Lucas Stach <l.stach@pengutronix.de>
Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
Diffstat (limited to 'drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c')
-rw-r--r-- | drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c b/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c index 8fa31ab1fb0a..51ed34586c10 100644 --- a/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c +++ b/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c @@ -38,17 +38,13 @@ static struct etnaviv_gem_submit *submit_create(struct drm_device *dev, struct etnaviv_gem_submit *submit; size_t sz = size_vstruct(nr, sizeof(submit->bos[0]), sizeof(*submit)); - submit = kmalloc(sz, GFP_KERNEL | __GFP_NOWARN | __GFP_NORETRY); - if (submit) { - submit->dev = dev; - submit->gpu = gpu; + submit = kzalloc(sz, GFP_KERNEL); + if (!submit) + return NULL; - /* initially, until copy_from_user() and bo lookup succeeds: */ - submit->nr_bos = 0; - submit->fence = NULL; + submit->gpu = gpu; - ww_acquire_init(&submit->ticket, &reservation_ww_class); - } + ww_acquire_init(&submit->ticket, &reservation_ww_class); return submit; } |