[COMMON] gpu: g2d: fix implicit type conversion
authorCho KyongHo <pullip.cho@samsung.com>
Thu, 23 Nov 2017 08:05:04 +0000 (17:05 +0900)
committerCosmin Tanislav <demonsingur@gmail.com>
Mon, 22 Apr 2024 17:22:15 +0000 (20:22 +0300)
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 <pullip.cho@samsung.com>
drivers/gpu/exynos/g2d/g2d_command.c
drivers/gpu/exynos/g2d/g2d_debug.c
drivers/gpu/exynos/g2d/g2d_drv.c
drivers/gpu/exynos/g2d/g2d_uapi_process.c

index 3fc110201a05447e1023e8935a93296cd19c766d..518ef372128f0e0c231cf61049a0cfb6d05dc87f 100644 (file)
@@ -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++;
index eab84c9597feb3466b14a5d6cc7edd244cc2ea6b..6f7bcd2776dc8fd1219301abda8f5e8ba7c0135f 100644 (file)
@@ -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",
index 45afe0c1964789750b49f237280e19ee25ec222f..7088416c466d34550fad1e2a535a5c1f232bee76 100644 (file)
@@ -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:
index ef5c4a59e66d24567019b569775959e86e517500..7d7f656b5e191676b0028fdbfb1a0061bcf002e1 100644 (file)
@@ -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) {