diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/channel_gk20a.c | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/channel_gk20a.c b/drivers/gpu/nvgpu/gk20a/channel_gk20a.c index 26285729..15170820 100644 --- a/drivers/gpu/nvgpu/gk20a/channel_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/channel_gk20a.c | |||
@@ -2548,11 +2548,16 @@ static int gk20a_submit_prepare_syncs(struct channel_gk20a *c, | |||
2548 | */ | 2548 | */ |
2549 | if (flags & NVGPU_SUBMIT_GPFIFO_FLAGS_FENCE_WAIT) { | 2549 | if (flags & NVGPU_SUBMIT_GPFIFO_FLAGS_FENCE_WAIT) { |
2550 | job->pre_fence = gk20a_alloc_fence(c); | 2550 | job->pre_fence = gk20a_alloc_fence(c); |
2551 | if (!job->pre_fence) { | ||
2552 | err = -ENOMEM; | ||
2553 | goto fail; | ||
2554 | } | ||
2555 | |||
2551 | if (!pre_alloc_enabled) | 2556 | if (!pre_alloc_enabled) |
2552 | job->wait_cmd = kzalloc(sizeof(struct priv_cmd_entry), | 2557 | job->wait_cmd = kzalloc(sizeof(struct priv_cmd_entry), |
2553 | GFP_KERNEL); | 2558 | GFP_KERNEL); |
2554 | 2559 | ||
2555 | if (!job->wait_cmd || !job->pre_fence) { | 2560 | if (!job->wait_cmd) { |
2556 | err = -ENOMEM; | 2561 | err = -ENOMEM; |
2557 | goto clean_up_pre_fence; | 2562 | goto clean_up_pre_fence; |
2558 | } | 2563 | } |
@@ -2572,7 +2577,7 @@ static int gk20a_submit_prepare_syncs(struct channel_gk20a *c, | |||
2572 | *wait_cmd = job->wait_cmd; | 2577 | *wait_cmd = job->wait_cmd; |
2573 | *pre_fence = job->pre_fence; | 2578 | *pre_fence = job->pre_fence; |
2574 | } else | 2579 | } else |
2575 | goto clean_up_pre_fence; | 2580 | goto clean_up_wait_cmd; |
2576 | } | 2581 | } |
2577 | 2582 | ||
2578 | if ((flags & NVGPU_SUBMIT_GPFIFO_FLAGS_FENCE_GET) && | 2583 | if ((flags & NVGPU_SUBMIT_GPFIFO_FLAGS_FENCE_GET) && |
@@ -2585,11 +2590,15 @@ static int gk20a_submit_prepare_syncs(struct channel_gk20a *c, | |||
2585 | * sync_pt/semaphore PB is added to the GPFIFO later on in submit. | 2590 | * sync_pt/semaphore PB is added to the GPFIFO later on in submit. |
2586 | */ | 2591 | */ |
2587 | job->post_fence = gk20a_alloc_fence(c); | 2592 | job->post_fence = gk20a_alloc_fence(c); |
2593 | if (!job->post_fence) { | ||
2594 | err = -ENOMEM; | ||
2595 | goto clean_up_wait_cmd; | ||
2596 | } | ||
2588 | if (!pre_alloc_enabled) | 2597 | if (!pre_alloc_enabled) |
2589 | job->incr_cmd = kzalloc(sizeof(struct priv_cmd_entry), | 2598 | job->incr_cmd = kzalloc(sizeof(struct priv_cmd_entry), |
2590 | GFP_KERNEL); | 2599 | GFP_KERNEL); |
2591 | 2600 | ||
2592 | if (!job->incr_cmd || !job->post_fence) { | 2601 | if (!job->incr_cmd) { |
2593 | err = -ENOMEM; | 2602 | err = -ENOMEM; |
2594 | goto clean_up_post_fence; | 2603 | goto clean_up_post_fence; |
2595 | } | 2604 | } |
@@ -2606,25 +2615,27 @@ static int gk20a_submit_prepare_syncs(struct channel_gk20a *c, | |||
2606 | *incr_cmd = job->incr_cmd; | 2615 | *incr_cmd = job->incr_cmd; |
2607 | *post_fence = job->post_fence; | 2616 | *post_fence = job->post_fence; |
2608 | } else | 2617 | } else |
2609 | goto clean_up_post_fence; | 2618 | goto clean_up_incr_cmd; |
2610 | 2619 | ||
2611 | return 0; | 2620 | return 0; |
2612 | 2621 | ||
2622 | clean_up_incr_cmd: | ||
2623 | free_priv_cmdbuf(c, job->incr_cmd); | ||
2624 | if (!pre_alloc_enabled) | ||
2625 | job->incr_cmd = NULL; | ||
2613 | clean_up_post_fence: | 2626 | clean_up_post_fence: |
2614 | gk20a_fence_put(job->post_fence); | 2627 | gk20a_fence_put(job->post_fence); |
2615 | job->post_fence = NULL; | 2628 | job->post_fence = NULL; |
2616 | free_priv_cmdbuf(c, job->incr_cmd); | 2629 | clean_up_wait_cmd: |
2630 | free_priv_cmdbuf(c, job->wait_cmd); | ||
2617 | if (!pre_alloc_enabled) | 2631 | if (!pre_alloc_enabled) |
2618 | job->incr_cmd = NULL; | 2632 | job->wait_cmd = NULL; |
2619 | clean_up_pre_fence: | 2633 | clean_up_pre_fence: |
2620 | gk20a_fence_put(job->pre_fence); | 2634 | gk20a_fence_put(job->pre_fence); |
2621 | job->pre_fence = NULL; | 2635 | job->pre_fence = NULL; |
2622 | free_priv_cmdbuf(c, job->wait_cmd); | 2636 | fail: |
2623 | if (!pre_alloc_enabled) | ||
2624 | job->wait_cmd = NULL; | ||
2625 | *wait_cmd = NULL; | 2637 | *wait_cmd = NULL; |
2626 | *pre_fence = NULL; | 2638 | *pre_fence = NULL; |
2627 | fail: | ||
2628 | return err; | 2639 | return err; |
2629 | } | 2640 | } |
2630 | 2641 | ||