From d29afd2c9e990799b470bb95a97935cf5b5020db Mon Sep 17 00:00:00 2001 From: Terje Bergstrom Date: Wed, 9 Nov 2016 15:53:16 -0800 Subject: gpu: nvgpu: Fix signed comparison bugs Fix small problems related to signed versus unsigned comparisons throughout the driver. Bump up the warning level to prevent such problems from occuring in future. Change-Id: I8ff5efb419f664e8a2aedadd6515ae4d18502ae0 Signed-off-by: Terje Bergstrom Reviewed-on: http://git-master/r/1252068 Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/gm20b/acr_gm20b.c | 2 +- drivers/gpu/nvgpu/gm20b/fb_gm20b.c | 4 ++-- drivers/gpu/nvgpu/gm20b/fifo_gm20b.c | 2 +- drivers/gpu/nvgpu/gm20b/gr_gm20b.c | 6 +++--- drivers/gpu/nvgpu/gm20b/ltc_gm20b.c | 8 ++++---- 5 files changed, 11 insertions(+), 11 deletions(-) (limited to 'drivers/gpu/nvgpu/gm20b') diff --git a/drivers/gpu/nvgpu/gm20b/acr_gm20b.c b/drivers/gpu/nvgpu/gm20b/acr_gm20b.c index f9e2d477..1d0379c5 100644 --- a/drivers/gpu/nvgpu/gm20b/acr_gm20b.c +++ b/drivers/gpu/nvgpu/gm20b/acr_gm20b.c @@ -1185,7 +1185,7 @@ int acr_ucode_patch_sig(struct gk20a *g, unsigned int *p_patch_loc, unsigned int *p_patch_ind) { - int i, *p_sig; + unsigned int i, *p_sig; gm20b_dbg_pmu(""); if (!pmu_is_debug_mode_en(g)) { diff --git a/drivers/gpu/nvgpu/gm20b/fb_gm20b.c b/drivers/gpu/nvgpu/gm20b/fb_gm20b.c index c65cd450..ecc1d0d5 100644 --- a/drivers/gpu/nvgpu/gm20b/fb_gm20b.c +++ b/drivers/gpu/nvgpu/gm20b/fb_gm20b.c @@ -101,12 +101,12 @@ static bool gm20b_fb_set_use_full_comp_tag_line(struct gk20a *g) return true; } -static int gm20b_fb_compression_page_size(struct gk20a *g) +static unsigned int gm20b_fb_compression_page_size(struct gk20a *g) { return SZ_128K; } -static int gm20b_fb_compressible_page_size(struct gk20a *g) +static unsigned int gm20b_fb_compressible_page_size(struct gk20a *g) { return SZ_64K; } diff --git a/drivers/gpu/nvgpu/gm20b/fifo_gm20b.c b/drivers/gpu/nvgpu/gm20b/fifo_gm20b.c index 3b877db1..bb38a6f1 100644 --- a/drivers/gpu/nvgpu/gm20b/fifo_gm20b.c +++ b/drivers/gpu/nvgpu/gm20b/fifo_gm20b.c @@ -80,7 +80,7 @@ static void gm20b_fifo_trigger_mmu_fault(struct gk20a *g, } else { u32 mmu_id = gm20b_engine_id_to_mmu_id(g, engine_id); - if (mmu_id != ~0) + if (mmu_id != (u32)~0) gk20a_writel(g, fifo_trigger_mmu_fault_r(mmu_id), fifo_trigger_mmu_fault_enable_f(1)); } diff --git a/drivers/gpu/nvgpu/gm20b/gr_gm20b.c b/drivers/gpu/nvgpu/gm20b/gr_gm20b.c index 56812fa6..cff0774d 100644 --- a/drivers/gpu/nvgpu/gm20b/gr_gm20b.c +++ b/drivers/gpu/nvgpu/gm20b/gr_gm20b.c @@ -548,11 +548,11 @@ static void gr_gm20b_load_tpc_mask(struct gk20a *g) fuse_tpc_mask = g->ops.gr.get_gpc_tpc_mask(g, 0); if (g->tpc_fs_mask_user && g->tpc_fs_mask_user != fuse_tpc_mask && - fuse_tpc_mask == (0x1 << g->gr.max_tpc_count) - 1) { + fuse_tpc_mask == (0x1U << g->gr.max_tpc_count) - 1U) { u32 val = g->tpc_fs_mask_user; - val &= (0x1 << g->gr.max_tpc_count) - 1; + val &= (0x1U << g->gr.max_tpc_count) - 1U; /* skip tpc to disable the other tpc cause channel timeout */ - val = (0x1 << hweight32(val)) - 1; + val = (0x1U << hweight32(val)) - 1U; gk20a_writel(g, gr_fe_tpc_fs_r(), val); } else { gk20a_writel(g, gr_fe_tpc_fs_r(), pes_tpc_mask); diff --git a/drivers/gpu/nvgpu/gm20b/ltc_gm20b.c b/drivers/gpu/nvgpu/gm20b/ltc_gm20b.c index fee9a807..6cb238b7 100644 --- a/drivers/gpu/nvgpu/gm20b/ltc_gm20b.c +++ b/drivers/gpu/nvgpu/gm20b/ltc_gm20b.c @@ -198,7 +198,7 @@ void gm20b_ltc_init_fs_state(struct gk20a *g) void gm20b_ltc_isr(struct gk20a *g) { u32 mc_intr, ltc_intr; - int ltc, slice; + unsigned int ltc, slice; u32 ltc_stride = nvgpu_get_litter_value(g, GPU_LIT_LTC_STRIDE); u32 lts_stride = nvgpu_get_litter_value(g, GPU_LIT_LTS_STRIDE); @@ -227,8 +227,8 @@ void gm20b_ltc_g_elpg_flush_locked(struct gk20a *g) u32 data; bool done[g->ltc_count]; s32 retry = 100; - int i; - int num_done = 0; + unsigned int i; + unsigned int num_done = 0; u32 ltc_d = ltc_ltc1_ltss_g_elpg_r() - ltc_ltc0_ltss_g_elpg_r(); gk20a_dbg_fn(""); @@ -289,7 +289,7 @@ u32 gm20b_ltc_cbc_fix_config(struct gk20a *g, int base) void gm20b_flush_ltc(struct gk20a *g) { unsigned long timeout; - int ltc; + unsigned int ltc; u32 ltc_stride = nvgpu_get_litter_value(g, GPU_LIT_LTC_STRIDE); #define __timeout_init() \ -- cgit v1.2.2