From 90024cb73a0ebbdcf2b03648aac0973ddada2153 Mon Sep 17 00:00:00 2001 From: Philip Elcan Date: Mon, 17 Dec 2018 16:54:50 -0500 Subject: [PATCH] gpu: nvgpu: misc MISRA 14.4 fixes This fixes a few lingering MISRA Rule 14.4 violations. Rule 14.4 requires that the condition of an if statement be a boolean. JIRA NVGPU-1022 Change-Id: Ib6293e00e0436fceee9f7bf0ada1b6ac01a82faa Signed-off-by: Philip Elcan Reviewed-on: https://git-master.nvidia.com/r/1975424 Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/common/fifo/channel.c | 2 +- drivers/gpu/nvgpu/common/fifo/tsg.c | 4 ++-- drivers/gpu/nvgpu/gk20a/fifo_gk20a.c | 2 +- drivers/gpu/nvgpu/os/posix/timers.c | 8 ++++---- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/nvgpu/common/fifo/channel.c b/drivers/gpu/nvgpu/common/fifo/channel.c index e36f0058b..166a6e26c 100644 --- a/drivers/gpu/nvgpu/common/fifo/channel.c +++ b/drivers/gpu/nvgpu/common/fifo/channel.c @@ -936,7 +936,7 @@ int channel_gk20a_alloc_job(struct channel_gk20a *c, */ nvgpu_smp_rmb(); - if (CIRC_SPACE(put, get, c->joblist.pre_alloc.length)) { + if (CIRC_SPACE(put, get, c->joblist.pre_alloc.length) != 0) { *job_out = &c->joblist.pre_alloc.jobs[put]; } else { nvgpu_warn(c->g, diff --git a/drivers/gpu/nvgpu/common/fifo/tsg.c b/drivers/gpu/nvgpu/common/fifo/tsg.c index 2cef097c4..86f090a2c 100644 --- a/drivers/gpu/nvgpu/common/fifo/tsg.c +++ b/drivers/gpu/nvgpu/common/fifo/tsg.c @@ -250,7 +250,7 @@ bool nvgpu_tsg_mark_error(struct gk20a *g, nvgpu_rwsem_down_read(&tsg->ch_list_lock); nvgpu_list_for_each_entry(ch, &tsg->ch_list, channel_gk20a, ch_entry) { - if (gk20a_channel_get(ch)) { + if (gk20a_channel_get(ch) != NULL) { if (nvgpu_channel_mark_error(g, ch)) { verbose = true; } @@ -272,7 +272,7 @@ void nvgpu_tsg_set_ctx_mmu_error(struct gk20a *g, nvgpu_rwsem_down_read(&tsg->ch_list_lock); nvgpu_list_for_each_entry(ch, &tsg->ch_list, channel_gk20a, ch_entry) { - if (gk20a_channel_get(ch)) { + if (gk20a_channel_get(ch) != NULL) { nvgpu_channel_set_ctx_mmu_error(g, ch); gk20a_channel_put(ch); } diff --git a/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c b/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c index 23ce32118..3f02132b3 100644 --- a/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c @@ -2215,7 +2215,7 @@ static u32 fifo_error_isr(struct gk20a *g, u32 fifo_intr) /* pio mode is unused. this shouldn't happen, ever. */ /* should we clear it or just leave it pending? */ nvgpu_err(g, "fifo pio error!"); - BUG_ON(1); + BUG(); } if ((fifo_intr & fifo_intr_0_bind_error_pending_f()) != 0U) { diff --git a/drivers/gpu/nvgpu/os/posix/timers.c b/drivers/gpu/nvgpu/os/posix/timers.c index 3e4974607..83038af7c 100644 --- a/drivers/gpu/nvgpu/os/posix/timers.c +++ b/drivers/gpu/nvgpu/os/posix/timers.c @@ -42,7 +42,7 @@ static bool time_after(s64 a, s64 b) int nvgpu_timeout_init(struct gk20a *g, struct nvgpu_timeout *timeout, u32 duration, unsigned long flags) { - if (flags & ~NVGPU_TIMER_FLAG_MASK) + if ((flags & ~NVGPU_TIMER_FLAG_MASK) != 0U) return -EINVAL; (void) memset(timeout, 0, sizeof(*timeout)); @@ -50,7 +50,7 @@ int nvgpu_timeout_init(struct gk20a *g, struct nvgpu_timeout *timeout, timeout->g = g; timeout->flags = flags; - if (flags & NVGPU_TIMER_RETRY_TIMER) + if ((flags & NVGPU_TIMER_RETRY_TIMER) != 0U) timeout->retries.max = duration; else timeout->time = nvgpu_current_time_ms() + (s64)duration; @@ -109,7 +109,7 @@ int __nvgpu_timeout_expired_msg(struct nvgpu_timeout *timeout, va_list args; va_start(args, fmt); - if (timeout->flags & NVGPU_TIMER_RETRY_TIMER) + if ((timeout->flags & NVGPU_TIMER_RETRY_TIMER) != 0U) ret = __nvgpu_timeout_expired_msg_retry(timeout, caller, fmt, args); else @@ -122,7 +122,7 @@ int __nvgpu_timeout_expired_msg(struct nvgpu_timeout *timeout, int nvgpu_timeout_peek_expired(struct nvgpu_timeout *timeout) { - if (timeout->flags & NVGPU_TIMER_RETRY_TIMER) + if ((timeout->flags & NVGPU_TIMER_RETRY_TIMER) != 0U) return timeout->retries.attempted >= timeout->retries.max; else return time_after(now(), timeout->time);