From ed76fbf2d83c714887aa63d847c612991ce53eba Mon Sep 17 00:00:00 2001 From: Cho KyongHo Date: Thu, 23 Nov 2017 17:05:04 +0900 Subject: [PATCH] [COMMON] gpu: g2d: fix implicit type conversion Prevent CID: 202021 Prevent CID: 202003 Prevent CID: 202000 Prevent CID: 201961 Prevent CID: 201909 Prevent CID: 201887 Prevent CID: 201224 Change-Id: I93b6f65617f0e25e11e63eff0fe46da42f3a0117 Signed-off-by: Cho KyongHo --- drivers/gpu/exynos/g2d/g2d_command.c | 6 ++++-- drivers/gpu/exynos/g2d/g2d_debug.c | 8 ++++---- drivers/gpu/exynos/g2d/g2d_drv.c | 2 +- drivers/gpu/exynos/g2d/g2d_uapi_process.c | 8 ++++---- 4 files changed, 13 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/exynos/g2d/g2d_command.c b/drivers/gpu/exynos/g2d/g2d_command.c index 3fc110201a05..518ef372128f 100644 --- a/drivers/gpu/exynos/g2d/g2d_command.c +++ b/drivers/gpu/exynos/g2d/g2d_command.c @@ -756,7 +756,8 @@ static bool g2d_validate_extra_command(struct g2d_device *g2d_dev, struct g2d_reg extra[], unsigned int num_regs) { - unsigned int n, i; + unsigned int n; + size_t i; /* * TODO: NxM loop ==> total 2008 comparison are required in maximum: * Consider if we can make it simple with a single range [0x2000, 4000) @@ -845,7 +846,8 @@ int g2d_import_commands(struct g2d_device *g2d_dev, struct g2d_task *task, cmdaddr += cmds->num_extra_regs; for (base = 0x3600; base < 0x3800; base += 0x100) { for (i = 0; i < NR_TM_LUT_VALUES; i++) { - cmdaddr->offset = base + i * sizeof(u32); + cmdaddr->offset = + (unsigned long)(base + i * sizeof(u32)); cmdaddr->value = tm_tuned_lut[i]; cmdaddr++; task->cmd_count++; diff --git a/drivers/gpu/exynos/g2d/g2d_debug.c b/drivers/gpu/exynos/g2d/g2d_debug.c index eab84c9597fe..6f7bcd2776dc 100644 --- a/drivers/gpu/exynos/g2d/g2d_debug.c +++ b/drivers/gpu/exynos/g2d/g2d_debug.c @@ -30,7 +30,7 @@ static unsigned int g2d_debug; static struct g2d_stamp { ktime_t time; struct g2d_task *task; - u32 state; + unsigned long state; u32 job_id; u32 val; s32 info; @@ -55,7 +55,7 @@ static int g2d_stamp_show(struct seq_file *s, void *unused) while (1) { stamp = &g2d_stamp_list[i]; - seq_printf(s, "[%4d] %u:%2u@%u (0x%2x) %6d %06llu\n", i++, + seq_printf(s, "[%4d] %u:%2u@%u (0x%2lx) %6d %06llu\n", i++, stamp->cpu, stamp->job_id, stamp->val, stamp->state, stamp->info, ktime_to_us(stamp->time)); @@ -167,8 +167,8 @@ void g2d_dump_sfr(struct g2d_device *g2d_dev, struct g2d_task *task) { unsigned int i, num_array; - num_array = ARRAY_SIZE(g2d_reg_info) - G2D_MAX_IMAGES + - ((task) ? task->num_source : G2D_MAX_IMAGES); + num_array = (unsigned int)ARRAY_SIZE(g2d_reg_info) - G2D_MAX_IMAGES + + ((task) ? task->num_source : G2D_MAX_IMAGES); for (i = 0; i < num_array; i++) { pr_info("[%s: %04X .. %04X]\n", diff --git a/drivers/gpu/exynos/g2d/g2d_drv.c b/drivers/gpu/exynos/g2d/g2d_drv.c index 45afe0c19647..7088416c466d 100644 --- a/drivers/gpu/exynos/g2d/g2d_drv.c +++ b/drivers/gpu/exynos/g2d/g2d_drv.c @@ -544,7 +544,7 @@ static long g2d_compat_ioctl(struct file *filp, switch (cmd) { case COMPAT_G2D_IOC_PROCESS: - cmd = G2D_IOC_PROCESS; + cmd = (unsigned int)G2D_IOC_PROCESS; break; case G2D_IOC_PRIORITY: case G2D_IOC_PERFORMANCE: diff --git a/drivers/gpu/exynos/g2d/g2d_uapi_process.c b/drivers/gpu/exynos/g2d/g2d_uapi_process.c index ef5c4a59e66d..7d7f656b5e19 100644 --- a/drivers/gpu/exynos/g2d/g2d_uapi_process.c +++ b/drivers/gpu/exynos/g2d/g2d_uapi_process.c @@ -150,8 +150,8 @@ static int g2d_prepare_buffer(struct g2d_device *g2d_dev, if (data->num_buffers > 1) { for (i = 0; i < data->num_buffers; i++) { - payload = g2d_get_payload_index(cmd, fmt, i, - data->num_buffers); + payload = (unsigned int)g2d_get_payload_index( + cmd, fmt, i, data->num_buffers); if (data->buffer[i].length < payload) { dev_err(dev, "%s: Too small buffer[%d]: expected %uB" @@ -167,7 +167,7 @@ static int g2d_prepare_buffer(struct g2d_device *g2d_dev, layer->buffer[i].payload = payload; } } else { - payload = g2d_get_payload(cmd, fmt, layer->flags); + payload = (unsigned int)g2d_get_payload(cmd, fmt, layer->flags); if (data->buffer[0].length < payload) { dev_err(dev, "%s: Too small buffer: expected %uB" " for %ux%u(bt %u)/%s but %uB is given\n", @@ -709,7 +709,7 @@ static int g2d_get_target(struct g2d_device *g2d_dev, struct g2d_context *ctx, data->num_buffers = 1; data->buffer[0].dmabuf.offset = 0; - data->buffer[0].length = ctx->hwfc_info->bufs[idx]->size; + data->buffer[0].length = (__u32)ctx->hwfc_info->bufs[idx]->size; } if (target->buffer_type == G2D_BUFTYPE_EMPTY) { -- 2.20.1