gpu: nvgpu: Fix nvgpu_sim_esc_readl 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_sim_esc_readl by
changing its return to void and printing an error message instead.

JIRA NVGPU-677

Change-Id: I949bea253dafc316c7dfbf870eb1225b6fc5b9c3
Signed-off-by: Nicolas Benech <nbenech@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1812887
Reviewed-by: Alex Waterman <alexw@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Nicolas Benech
2018-09-04 21:38:13 -04:00
committed by mobile promotions
parent ba1245d8f7
commit 4451cf29d4
3 changed files with 15 additions and 7 deletions

View File

@@ -28,6 +28,7 @@
#include <nvgpu/hw_sim.h>
#include <nvgpu/sim.h>
#include <nvgpu/utils.h>
#include <nvgpu/bug.h>
#include "gk20a/gk20a.h"
@@ -215,7 +216,7 @@ static int issue_rpc_and_wait(struct gk20a *g)
return 0;
}
static int nvgpu_sim_esc_readl(struct gk20a *g,
static void nvgpu_sim_esc_readl(struct gk20a *g,
char *path, u32 index, u32 *data)
{
int err;
@@ -232,9 +233,12 @@ static int nvgpu_sim_esc_readl(struct gk20a *g,
err = issue_rpc_and_wait(g);
if (!err)
if (err == 0) {
memcpy(data, sim_msg_param(g, data_offset), sizeof(u32));
return err;
} else {
*data = 0xffffffff;
WARN(1, "issue_rpc_and_wait failed err=%d", err);
}
}
static void nvgpu_sim_init_late(struct gk20a *g)

View File

@@ -27,6 +27,7 @@
#include <nvgpu/sim.h>
#include <nvgpu/io.h>
#include <nvgpu/utils.h>
#include <nvgpu/bug.h>
#include "gk20a/gk20a.h"
@@ -183,7 +184,7 @@ static int issue_rpc_and_wait(struct gk20a *g)
return 0;
}
static int nvgpu_sim_esc_readl(struct gk20a *g,
static void nvgpu_sim_esc_readl(struct gk20a *g,
char *path, u32 index, u32 *data)
{
int err;
@@ -200,9 +201,12 @@ static int nvgpu_sim_esc_readl(struct gk20a *g,
err = issue_rpc_and_wait(g);
if (!err)
if (err == 0) {
memcpy(data, sim_msg_param(g, data_offset + 0xc), sizeof(u32));
return err;
} else {
*data = 0xffffffff;
WARN(1, "issue_rpc_and_wait failed err=%d", err);
}
}
static void nvgpu_sim_init_late(struct gk20a *g)

View File

@@ -36,7 +36,7 @@ struct sim_nvgpu {
struct nvgpu_mem msg_bfr;
void (*sim_init_late)(struct gk20a *);
void (*remove_support)(struct gk20a *);
int (*esc_readl)(
void (*esc_readl)(
struct gk20a *g, char *path, u32 index, u32 *data);
};
#ifdef __KERNEL__