From 2eface802a4aea417206bcdda689a65cf47d300b Mon Sep 17 00:00:00 2001 From: Nicolas Benech Date: Thu, 23 Aug 2018 16:23:52 -0400 Subject: 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 Reviewed-on: https://git-master.nvidia.com/r/1805598 Reviewed-by: svc-misra-checker GVS: Gerrit_Virtual_Submit Reviewed-by: Alex Waterman Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/common/mm/comptags.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'drivers/gpu/nvgpu/common/mm/comptags.c') diff --git a/drivers/gpu/nvgpu/common/mm/comptags.c b/drivers/gpu/nvgpu/common/mm/comptags.c index e6c99702..334236ec 100644 --- a/drivers/gpu/nvgpu/common/mm/comptags.c +++ b/drivers/gpu/nvgpu/common/mm/comptags.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2017-2018, NVIDIA CORPORATION. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -66,7 +66,12 @@ int gk20a_comptag_allocator_init(struct gk20a *g, struct gk20a_comptag_allocator *allocator, unsigned long size) { - nvgpu_mutex_init(&allocator->lock); + int err = nvgpu_mutex_init(&allocator->lock); + + if (err != 0) { + nvgpu_err(g, "Error in allocator.lock mutex initialization"); + return err; + } /* * 0th comptag is special and is never used. The base for this bitmap -- cgit v1.2.2