diff options
author | Nicolas Benech <nbenech@nvidia.com> | 2018-08-23 16:23:52 -0400 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2018-09-05 23:39:08 -0400 |
commit | 2eface802a4aea417206bcdda689a65cf47d300b (patch) | |
tree | 502af9d48004af4edf8f02a2a7cf751ef5a11325 /drivers/gpu/nvgpu/gk20a/fifo_gk20a.c | |
parent | b44c7fdb114a63ab98fffc0f246776b56399ff64 (diff) |
gpu: nvgpu: Fix mutex MISRA 17.7 violations
MISRA Rule-17.7 requires the return value of all functions to be used.
Fix is either to use the return value or change the function to return
void. This patch contains fix for calls to nvgpu_mutex_init and
improves related error handling.
JIRA NVGPU-677
Change-Id: I609fa138520cc7ccfdd5aa0e7fd28c8ca0b3a21c
Signed-off-by: Nicolas Benech <nbenech@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1805598
Reviewed-by: svc-misra-checker <svc-misra-checker@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Alex Waterman <alexw@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/fifo_gk20a.c')
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/fifo_gk20a.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c b/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c index f06bf1c5..9dfe3083 100644 --- a/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c | |||
@@ -696,6 +696,7 @@ static int init_runlist(struct gk20a *g, struct fifo_gk20a *f) | |||
696 | u32 active_engine_id, pbdma_id, engine_id; | 696 | u32 active_engine_id, pbdma_id, engine_id; |
697 | int flags = nvgpu_is_enabled(g, NVGPU_MM_USE_PHYSICAL_SG) ? | 697 | int flags = nvgpu_is_enabled(g, NVGPU_MM_USE_PHYSICAL_SG) ? |
698 | NVGPU_DMA_FORCE_CONTIGUOUS : 0; | 698 | NVGPU_DMA_FORCE_CONTIGUOUS : 0; |
699 | int err = 0; | ||
699 | 700 | ||
700 | nvgpu_log_fn(g, " "); | 701 | nvgpu_log_fn(g, " "); |
701 | 702 | ||
@@ -733,7 +734,7 @@ static int init_runlist(struct gk20a *g, struct fifo_gk20a *f) | |||
733 | f->num_runlist_entries, runlist_size); | 734 | f->num_runlist_entries, runlist_size); |
734 | 735 | ||
735 | for (i = 0; i < MAX_RUNLIST_BUFFERS; i++) { | 736 | for (i = 0; i < MAX_RUNLIST_BUFFERS; i++) { |
736 | int err = nvgpu_dma_alloc_flags_sys(g, flags, | 737 | err = nvgpu_dma_alloc_flags_sys(g, flags, |
737 | runlist_size, | 738 | runlist_size, |
738 | &runlist->mem[i]); | 739 | &runlist->mem[i]); |
739 | if (err) { | 740 | if (err) { |
@@ -741,7 +742,13 @@ static int init_runlist(struct gk20a *g, struct fifo_gk20a *f) | |||
741 | goto clean_up_runlist; | 742 | goto clean_up_runlist; |
742 | } | 743 | } |
743 | } | 744 | } |
744 | nvgpu_mutex_init(&runlist->runlist_lock); | 745 | |
746 | err = nvgpu_mutex_init(&runlist->runlist_lock); | ||
747 | if (err != 0) { | ||
748 | nvgpu_err(g, | ||
749 | "Error in runlist_lock mutex initialization"); | ||
750 | goto clean_up_runlist; | ||
751 | } | ||
745 | 752 | ||
746 | /* None of buffers is pinned if this value doesn't change. | 753 | /* None of buffers is pinned if this value doesn't change. |
747 | Otherwise, one of them (cur_buffer) must have been pinned. */ | 754 | Otherwise, one of them (cur_buffer) must have been pinned. */ |
@@ -773,7 +780,7 @@ static int init_runlist(struct gk20a *g, struct fifo_gk20a *f) | |||
773 | clean_up_runlist: | 780 | clean_up_runlist: |
774 | gk20a_fifo_delete_runlist(f); | 781 | gk20a_fifo_delete_runlist(f); |
775 | nvgpu_log_fn(g, "fail"); | 782 | nvgpu_log_fn(g, "fail"); |
776 | return -ENOMEM; | 783 | return err; |
777 | } | 784 | } |
778 | 785 | ||
779 | u32 gk20a_fifo_intr_0_error_mask(struct gk20a *g) | 786 | u32 gk20a_fifo_intr_0_error_mask(struct gk20a *g) |