gpu: nvgpu: Fix LibC MISRA 17.7 in os/linux

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 all 17.7 violations instandard C functions
in OS/Linux interface.

JIRA NVGPU-1036

Change-Id: I39b20f1d0e1a1da56d452f2c3d5ee049666cefe8
Signed-off-by: Nicolas Benech <nbenech@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1929900
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: svc-misra-checker <svc-misra-checker@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Alex Waterman <alexw@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-10-18 10:50:51 -04:00
committed by mobile promotions
parent e059f3cb12
commit b9e7ea65e1
26 changed files with 69 additions and 63 deletions

View File

@@ -290,7 +290,7 @@ static int gk20a_init_cde_buf(struct gk20a_cde_ctx *cde_ctx,
/* copy the content */ /* copy the content */
if (buf->data_byte_offset != 0) if (buf->data_byte_offset != 0)
memcpy(mem->cpu_va, img->data + buf->data_byte_offset, (void) memcpy(mem->cpu_va, img->data + buf->data_byte_offset,
buf->num_bytes); buf->num_bytes);
cde_ctx->num_bufs++; cde_ctx->num_bufs++;
@@ -644,8 +644,8 @@ static int gk20a_cde_pack_cmdbufs(struct gk20a_cde_ctx *cde_ctx)
} }
/* move the original init here and append convert */ /* move the original init here and append convert */
memcpy(combined_cmd, cde_ctx->init_convert_cmd, init_bytes); (void) memcpy(combined_cmd, cde_ctx->init_convert_cmd, init_bytes);
memcpy(combined_cmd + cde_ctx->init_cmd_num_entries, (void) memcpy(combined_cmd + cde_ctx->init_cmd_num_entries,
cde_ctx->convert_cmd, conv_bytes); cde_ctx->convert_cmd, conv_bytes);
nvgpu_kfree(g, cde_ctx->init_convert_cmd); nvgpu_kfree(g, cde_ctx->init_convert_cmd);
@@ -714,7 +714,7 @@ static int gk20a_init_cde_img(struct gk20a_cde_ctx *cde_ctx,
break; break;
} }
case TYPE_ARRAY: case TYPE_ARRAY:
memcpy(&cde_app->arrays[elem->array.id][0], (void) memcpy(&cde_app->arrays[elem->array.id][0],
elem->array.data, elem->array.data,
MAX_CDE_ARRAY_ENTRIES*sizeof(u32)); MAX_CDE_ARRAY_ENTRIES*sizeof(u32));
break; break;
@@ -1173,7 +1173,7 @@ __releases(&l->cde_app->mutex)
cde_ctx->scatterbuffer_size = scatterbuffer_size; cde_ctx->scatterbuffer_size = scatterbuffer_size;
/* remove existing argument data */ /* remove existing argument data */
memset(cde_ctx->user_param_values, 0, (void) memset(cde_ctx->user_param_values, 0,
sizeof(cde_ctx->user_param_values)); sizeof(cde_ctx->user_param_values));
/* read user space arguments for the conversion */ /* read user space arguments for the conversion */

View File

@@ -33,7 +33,7 @@ void gk20a_get_comptags(struct nvgpu_os_buffer *buf,
return; return;
if (!priv) { if (!priv) {
memset(comptags, 0, sizeof(*comptags)); (void) memset(comptags, 0, sizeof(*comptags));
return; return;
} }

View File

@@ -252,13 +252,15 @@ static int gk20a_ctxsw_dev_ioctl_ring_setup(struct gk20a_ctxsw_dev *dev,
static void nvgpu_set_ctxsw_trace_filter_args(struct nvgpu_gpu_ctxsw_trace_filter *filter_dst, static void nvgpu_set_ctxsw_trace_filter_args(struct nvgpu_gpu_ctxsw_trace_filter *filter_dst,
struct nvgpu_ctxsw_trace_filter *filter_src) struct nvgpu_ctxsw_trace_filter *filter_src)
{ {
memcpy(filter_dst->tag_bits, filter_src->tag_bits, (NVGPU_CTXSW_FILTER_SIZE + 63) / 64); (void) memcpy(filter_dst->tag_bits, filter_src->tag_bits,
(NVGPU_CTXSW_FILTER_SIZE + 63) / 64);
} }
static void nvgpu_get_ctxsw_trace_filter_args(struct nvgpu_ctxsw_trace_filter *filter_dst, static void nvgpu_get_ctxsw_trace_filter_args(struct nvgpu_ctxsw_trace_filter *filter_dst,
struct nvgpu_gpu_ctxsw_trace_filter *filter_src) struct nvgpu_gpu_ctxsw_trace_filter *filter_src)
{ {
memcpy(filter_dst->tag_bits, filter_src->tag_bits, (NVGPU_CTXSW_FILTER_SIZE + 63) / 64); (void) memcpy(filter_dst->tag_bits, filter_src->tag_bits,
(NVGPU_CTXSW_FILTER_SIZE + 63) / 64);
} }
static int gk20a_ctxsw_dev_ioctl_set_filter(struct gk20a_ctxsw_dev *dev, static int gk20a_ctxsw_dev_ioctl_set_filter(struct gk20a_ctxsw_dev *dev,
@@ -418,7 +420,7 @@ long gk20a_ctxsw_dev_ioctl(struct file *filp, unsigned int cmd,
(_IOC_SIZE(cmd) > NVGPU_CTXSW_IOCTL_MAX_ARG_SIZE)) (_IOC_SIZE(cmd) > NVGPU_CTXSW_IOCTL_MAX_ARG_SIZE))
return -EINVAL; return -EINVAL;
memset(buf, 0, sizeof(buf)); (void) memset(buf, 0, sizeof(buf));
if (_IOC_DIR(cmd) & _IOC_WRITE) { if (_IOC_DIR(cmd) & _IOC_WRITE) {
if (copy_from_user(buf, (void __user *) arg, _IOC_SIZE(cmd))) if (copy_from_user(buf, (void __user *) arg, _IOC_SIZE(cmd)))
return -EFAULT; return -EFAULT;
@@ -580,7 +582,7 @@ int gk20a_ctxsw_trace_init(struct gk20a *g)
return 0; return 0;
fail: fail:
memset(&g->ops.fecs_trace, 0, sizeof(g->ops.fecs_trace)); (void) memset(&g->ops.fecs_trace, 0, sizeof(g->ops.fecs_trace));
nvgpu_kfree(g, trace); nvgpu_kfree(g, trace);
g->ctxsw_trace = NULL; g->ctxsw_trace = NULL;
return err; return err;

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2017 NVIDIA Corporation. All rights reserved. * Copyright (C) 2018 NVIDIA Corporation. All rights reserved.
* *
* This software is licensed under the terms of the GNU General Public * This software is licensed under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation, and * License version 2, as published by the Free Software Foundation, and
@@ -164,7 +164,7 @@ static void print_histogram(struct nvgpu_mem_alloc_tracker *tracker,
u64 hr_bytes; u64 hr_bytes;
const char *hr_suffix; const char *hr_suffix;
memset(this_line, 0, sizeof(this_line)); (void) memset(this_line, 0, sizeof(this_line));
/* /*
* Compute the normalized line length. Cant use floating point * Compute the normalized line length. Cant use floating point
@@ -175,7 +175,7 @@ static void print_histogram(struct nvgpu_mem_alloc_tracker *tracker,
line_length *= sizeof(histogram_line); line_length *= sizeof(histogram_line);
line_length /= 1000; line_length /= 1000;
memset(this_line, '+', line_length); (void) memset(this_line, '+', line_length);
__to_human_readable_bytes(1 << (__ffs(pot_min) + i), __to_human_readable_bytes(1 << (__ffs(pot_min) + i),
&hr_bytes, &hr_suffix); &hr_bytes, &hr_suffix);

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2017 NVIDIA Corporation. All rights reserved. * Copyright (C) 2018 NVIDIA Corporation. All rights reserved.
* *
* This software is licensed under the terms of the GNU General Public * This software is licensed under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation, and * License version 2, as published by the Free Software Foundation, and
@@ -284,7 +284,7 @@ static int falc_trace_show(struct seq_file *s, void *data)
while (nvgpu_find_hex_in_string((trace+i+20+m), g, &k)) { while (nvgpu_find_hex_in_string((trace+i+20+m), g, &k)) {
if (k >= 40) if (k >= 40)
break; break;
strncpy(part_str, (trace+i+20+m), k); (void) strncpy(part_str, (trace+i+20+m), k);
part_str[k] = 0; part_str[k] = 0;
seq_printf(s, "%s0x%x", part_str, seq_printf(s, "%s0x%x", part_str,
trace1[(i / 4) + 1 + l]); trace1[(i / 4) + 1 + l]);
@@ -334,7 +334,7 @@ static ssize_t perfmon_events_enable_write(struct file *file,
int buf_size; int buf_size;
int err; int err;
memset(buf, 0, sizeof(buf)); (void) memset(buf, 0, sizeof(buf));
buf_size = min(count, (sizeof(buf)-1)); buf_size = min(count, (sizeof(buf)-1));
if (copy_from_user(buf, userbuf, buf_size)) if (copy_from_user(buf, userbuf, buf_size))

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2017 NVIDIA Corporation. All rights reserved. * Copyright (C) 2018 NVIDIA Corporation. All rights reserved.
* *
* This software is licensed under the terms of the GNU General Public * This software is licensed under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation, and * License version 2, as published by the Free Software Foundation, and
@@ -34,7 +34,7 @@ static ssize_t xve_link_speed_write(struct file *filp,
buff_size = min_t(size_t, 16, len); buff_size = min_t(size_t, 16, len);
memset(kbuff, 0, 16); (void) memset(kbuff, 0, 16);
if (copy_from_user(kbuff, buff, buff_size)) if (copy_from_user(kbuff, buff, buff_size))
return -EFAULT; return -EFAULT;

View File

@@ -40,7 +40,7 @@ static const struct firmware *do_request_firmware(struct device *dev,
if (!fw_path) if (!fw_path)
return NULL; return NULL;
sprintf(fw_path, "%s/%s", prefix, fw_name); (void) sprintf(fw_path, "%s/%s", prefix, fw_name);
fw_name = fw_path; fw_name = fw_path;
} }
@@ -93,7 +93,7 @@ struct nvgpu_firmware *nvgpu_request_firmware(struct gk20a *g,
if (!fw->data) if (!fw->data)
goto err_release; goto err_release;
memcpy(fw->data, linux_fw->data, linux_fw->size); (void) memcpy(fw->data, linux_fw->data, linux_fw->size);
fw->size = linux_fw->size; fw->size = linux_fw->size;
release_firmware(linux_fw); release_firmware(linux_fw);

View File

@@ -183,7 +183,7 @@ static int gk20a_as_ioctl_map_buffer_batch(
s16 incompressible_kind; s16 incompressible_kind;
struct nvgpu_as_map_buffer_ex_args map_args; struct nvgpu_as_map_buffer_ex_args map_args;
memset(&map_args, 0, sizeof(map_args)); (void) memset(&map_args, 0, sizeof(map_args));
if (copy_from_user(&map_args, &user_map_args[i], if (copy_from_user(&map_args, &user_map_args[i],
sizeof(map_args))) { sizeof(map_args))) {
@@ -249,7 +249,7 @@ static int gk20a_as_ioctl_get_va_regions(
struct nvgpu_as_va_region region; struct nvgpu_as_va_region region;
struct nvgpu_allocator *vma = vm->vma[i]; struct nvgpu_allocator *vma = vm->vma[i];
memset(&region, 0, sizeof(struct nvgpu_as_va_region)); (void) memset(&region, 0, sizeof(struct nvgpu_as_va_region));
region.page_size = vm->gmmu_page_sizes[i]; region.page_size = vm->gmmu_page_sizes[i];
region.offset = nvgpu_alloc_base(vma); region.offset = nvgpu_alloc_base(vma);
@@ -345,7 +345,7 @@ long gk20a_as_dev_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
(_IOC_SIZE(cmd) > NVGPU_AS_IOCTL_MAX_ARG_SIZE)) (_IOC_SIZE(cmd) > NVGPU_AS_IOCTL_MAX_ARG_SIZE))
return -EINVAL; return -EINVAL;
memset(buf, 0, sizeof(buf)); (void) memset(buf, 0, sizeof(buf));
if (_IOC_DIR(cmd) & _IOC_WRITE) { if (_IOC_DIR(cmd) & _IOC_WRITE) {
if (copy_from_user(buf, (void __user *)arg, _IOC_SIZE(cmd))) if (copy_from_user(buf, (void __user *)arg, _IOC_SIZE(cmd)))
return -EFAULT; return -EFAULT;

View File

@@ -396,7 +396,7 @@ static int gk20a_init_error_notifier(struct channel_gk20a *ch,
priv->error_notifier.notification = va + args->offset; priv->error_notifier.notification = va + args->offset;
priv->error_notifier.vaddr = va; priv->error_notifier.vaddr = va;
memset(priv->error_notifier.notification, 0, (void) memset(priv->error_notifier.notification, 0,
sizeof(struct nvgpu_notification)); sizeof(struct nvgpu_notification));
/* set channel notifiers pointer */ /* set channel notifiers pointer */
@@ -553,7 +553,7 @@ int gk20a_channel_open_ioctl(struct gk20a *g,
return err; return err;
fd = err; fd = err;
snprintf(name, sizeof(name), "nvhost-%s-fd%d", (void) snprintf(name, sizeof(name), "nvhost-%s-fd%d",
dev_name(dev_from_gk20a(g)), fd); dev_name(dev_from_gk20a(g)), fd);
file = anon_inode_getfile(name, l->channel.cdev.ops, NULL, O_RDWR); file = anon_inode_getfile(name, l->channel.cdev.ops, NULL, O_RDWR);

View File

@@ -198,7 +198,7 @@ static ssize_t nvgpu_clk_arb_read_event_dev(struct file *filp, char __user *buf,
if ((size - *off) < sizeof(info)) if ((size - *off) < sizeof(info))
return 0; return 0;
memset(&info, 0, sizeof(info)); (void) memset(&info, 0, sizeof(info));
/* Get the oldest event from the queue */ /* Get the oldest event from the queue */
while (!__pending_event(dev, &info)) { while (!__pending_event(dev, &info)) {
if (filp->f_flags & O_NONBLOCK) if (filp->f_flags & O_NONBLOCK)
@@ -257,7 +257,7 @@ static long nvgpu_clk_arb_ioctl_event_dev(struct file *filp, unsigned int cmd,
BUG_ON(_IOC_SIZE(cmd) > NVGPU_EVENT_IOCTL_MAX_ARG_SIZE); BUG_ON(_IOC_SIZE(cmd) > NVGPU_EVENT_IOCTL_MAX_ARG_SIZE);
memset(buf, 0, sizeof(buf)); (void) memset(buf, 0, sizeof(buf));
if (_IOC_DIR(cmd) & _IOC_WRITE) { if (_IOC_DIR(cmd) & _IOC_WRITE) {
if (copy_from_user(buf, (void __user *) arg, _IOC_SIZE(cmd))) if (copy_from_user(buf, (void __user *) arg, _IOC_SIZE(cmd)))
return -EFAULT; return -EFAULT;
@@ -327,7 +327,7 @@ static int nvgpu_clk_arb_install_fd(struct gk20a *g,
goto fail; goto fail;
} }
snprintf(name, sizeof(name), "%s-clk-fd%d", g->name, fd); (void) snprintf(name, sizeof(name), "%s-clk-fd%d", g->name, fd);
file = anon_inode_getfile(name, fops, dev, O_RDWR); file = anon_inode_getfile(name, fops, dev, O_RDWR);
if (IS_ERR(file)) { if (IS_ERR(file)) {
err = PTR_ERR(file); err = PTR_ERR(file);

View File

@@ -273,7 +273,7 @@ gk20a_ctrl_ioctl_gpu_characteristics(
return -EINVAL; return -EINVAL;
} }
memset(&gpu, 0, sizeof(gpu)); (void) memset(&gpu, 0, sizeof(gpu));
gpu.L2_cache_size = g->ops.ltc.determine_L2_size_bytes(g); gpu.L2_cache_size = g->ops.ltc.determine_L2_size_bytes(g);
gpu.on_board_video_memory_size = 0; /* integrated GPU */ gpu.on_board_video_memory_size = 0; /* integrated GPU */
@@ -477,7 +477,7 @@ static int gk20a_ctrl_alloc_as(
return err; return err;
fd = err; fd = err;
snprintf(name, sizeof(name), "nvhost-%s-fd%d", g->name, fd); (void) snprintf(name, sizeof(name), "nvhost-%s-fd%d", g->name, fd);
file = anon_inode_getfile(name, l->as_dev.cdev.ops, NULL, O_RDWR); file = anon_inode_getfile(name, l->as_dev.cdev.ops, NULL, O_RDWR);
if (IS_ERR(file)) { if (IS_ERR(file)) {
@@ -519,7 +519,7 @@ static int gk20a_ctrl_open_tsg(struct gk20a *g,
return err; return err;
fd = err; fd = err;
snprintf(name, sizeof(name), "nvgpu-%s-tsg%d", g->name, fd); (void) snprintf(name, sizeof(name), "nvgpu-%s-tsg%d", g->name, fd);
file = anon_inode_getfile(name, l->tsg.cdev.ops, NULL, O_RDWR); file = anon_inode_getfile(name, l->tsg.cdev.ops, NULL, O_RDWR);
if (IS_ERR(file)) { if (IS_ERR(file)) {
@@ -886,7 +886,7 @@ static int nvgpu_gpu_get_engine_info(
&g->fifo.engine_info[active_engine_id]; &g->fifo.engine_info[active_engine_id];
struct nvgpu_gpu_get_engine_info_item dst_info; struct nvgpu_gpu_get_engine_info_item dst_info;
memset(&dst_info, 0, sizeof(dst_info)); (void) memset(&dst_info, 0, sizeof(dst_info));
engine_enum = src_info->engine_enum; engine_enum = src_info->engine_enum;
@@ -1619,7 +1619,7 @@ long gk20a_ctrl_dev_ioctl(struct file *filp, unsigned int cmd, unsigned long arg
(_IOC_SIZE(cmd) > NVGPU_GPU_IOCTL_MAX_ARG_SIZE)) (_IOC_SIZE(cmd) > NVGPU_GPU_IOCTL_MAX_ARG_SIZE))
return -EINVAL; return -EINVAL;
memset(buf, 0, sizeof(buf)); (void) memset(buf, 0, sizeof(buf));
if (_IOC_DIR(cmd) & _IOC_WRITE) { if (_IOC_DIR(cmd) & _IOC_WRITE) {
if (copy_from_user(buf, (void __user *)arg, _IOC_SIZE(cmd))) if (copy_from_user(buf, (void __user *)arg, _IOC_SIZE(cmd)))
return -EFAULT; return -EFAULT;
@@ -1643,7 +1643,8 @@ long gk20a_ctrl_dev_ioctl(struct file *filp, unsigned int cmd, unsigned long arg
case NVGPU_GPU_IOCTL_ZCULL_GET_INFO: case NVGPU_GPU_IOCTL_ZCULL_GET_INFO:
get_info_args = (struct nvgpu_gpu_zcull_get_info_args *)buf; get_info_args = (struct nvgpu_gpu_zcull_get_info_args *)buf;
memset(get_info_args, 0, sizeof(struct nvgpu_gpu_zcull_get_info_args)); (void) memset(get_info_args, 0,
sizeof(struct nvgpu_gpu_zcull_get_info_args));
zcull_info = nvgpu_kzalloc(g, sizeof(struct gr_zcull_info)); zcull_info = nvgpu_kzalloc(g, sizeof(struct gr_zcull_info));
if (zcull_info == NULL) if (zcull_info == NULL)

View File

@@ -1872,7 +1872,7 @@ long gk20a_dbg_gpu_dev_ioctl(struct file *filp, unsigned int cmd,
(_IOC_SIZE(cmd) > NVGPU_DBG_GPU_IOCTL_MAX_ARG_SIZE)) (_IOC_SIZE(cmd) > NVGPU_DBG_GPU_IOCTL_MAX_ARG_SIZE))
return -EINVAL; return -EINVAL;
memset(buf, 0, sizeof(buf)); (void) memset(buf, 0, sizeof(buf));
if (_IOC_DIR(cmd) & _IOC_WRITE) { if (_IOC_DIR(cmd) & _IOC_WRITE) {
if (copy_from_user(buf, (void __user *)arg, _IOC_SIZE(cmd))) if (copy_from_user(buf, (void __user *)arg, _IOC_SIZE(cmd)))
return -EFAULT; return -EFAULT;

View File

@@ -305,7 +305,7 @@ static int gk20a_tsg_event_id_enable(struct tsg_gk20a *tsg,
goto free_ref; goto free_ref;
local_fd = err; local_fd = err;
snprintf(name, sizeof(name), "nvgpu-event%d-fd%d", (void) snprintf(name, sizeof(name), "nvgpu-event%d-fd%d",
event_id, local_fd); event_id, local_fd);
file = anon_inode_getfile(name, &gk20a_event_id_ops, file = anon_inode_getfile(name, &gk20a_event_id_ops,
@@ -612,7 +612,7 @@ long nvgpu_ioctl_tsg_dev_ioctl(struct file *filp, unsigned int cmd,
(_IOC_SIZE(cmd) > NVGPU_TSG_IOCTL_MAX_ARG_SIZE)) (_IOC_SIZE(cmd) > NVGPU_TSG_IOCTL_MAX_ARG_SIZE))
return -EINVAL; return -EINVAL;
memset(buf, 0, sizeof(buf)); (void) memset(buf, 0, sizeof(buf));
if (_IOC_DIR(cmd) & _IOC_WRITE) { if (_IOC_DIR(cmd) & _IOC_WRITE) {
if (copy_from_user(buf, (void __user *)arg, _IOC_SIZE(cmd))) if (copy_from_user(buf, (void __user *)arg, _IOC_SIZE(cmd)))
return -EFAULT; return -EFAULT;

View File

@@ -300,7 +300,7 @@ static int __nvgpu_free_kmem_alloc(struct nvgpu_mem_alloc_tracker *tracker,
return -EINVAL; return -EINVAL;
} }
memset((void *)alloc->addr, 0, alloc->size); (void) memset((void *)alloc->addr, 0, alloc->size);
tracker->nr_frees++; tracker->nr_frees++;
tracker->bytes_freed += alloc->size; tracker->bytes_freed += alloc->size;
@@ -621,7 +621,7 @@ struct nvgpu_kmem_cache *nvgpu_kmem_cache_create(struct gk20a *g, size_t size)
cache->g = g; cache->g = g;
snprintf(cache->name, sizeof(cache->name), (void) snprintf(cache->name, sizeof(cache->name),
"nvgpu-cache-0x%p-%d-%d", g, (int)size, "nvgpu-cache-0x%p-%d-%d", g, (int)size,
atomic_inc_return(&kmem_cache_id)); atomic_inc_return(&kmem_cache_id));
cache->cache = kmem_cache_create(cache->name, cache->cache = kmem_cache_create(cache->name,

View File

@@ -332,7 +332,7 @@ static int nvgpu_channel_init_os_fence_framework(struct channel_gk20a *ch,
fence_framework = &priv->fence_framework; fence_framework = &priv->fence_framework;
va_start(args, fmt); va_start(args, fmt);
vsnprintf(name, sizeof(name), fmt, args); (void) vsnprintf(name, sizeof(name), fmt, args);
va_end(args); va_end(args);
fence_framework->timeline = gk20a_sync_timeline_create(name); fence_framework->timeline = gk20a_sync_timeline_create(name);

View File

@@ -105,7 +105,7 @@ void __nvgpu_log_msg(struct gk20a *g, const char *func_name, int line,
va_list args; va_list args;
va_start(args, fmt); va_start(args, fmt);
vsnprintf(log, LOG_BUFFER_LENGTH, fmt, args); (void) vsnprintf(log, LOG_BUFFER_LENGTH, fmt, args);
va_end(args); va_end(args);
__nvgpu_really_print_log(0, g ? nvgpu_log_name(g) : "", __nvgpu_really_print_log(0, g ? nvgpu_log_name(g) : "",
@@ -124,7 +124,7 @@ void __nvgpu_log_dbg(struct gk20a *g, u64 log_mask,
return; return;
va_start(args, fmt); va_start(args, fmt);
vsnprintf(log, LOG_BUFFER_LENGTH, fmt, args); (void) vsnprintf(log, LOG_BUFFER_LENGTH, fmt, args);
va_end(args); va_end(args);
__nvgpu_really_print_log(g->log_trace, nvgpu_log_name(g), __nvgpu_really_print_log(g->log_trace, nvgpu_log_name(g),

View File

@@ -202,7 +202,7 @@ int __nvgpu_mem_create_from_pages(struct gk20a *g, struct nvgpu_mem *dest,
if (!our_pages) if (!our_pages)
return -ENOMEM; return -ENOMEM;
memcpy(our_pages, pages, sizeof(struct page *) * nr_pages); (void) memcpy(our_pages, pages, sizeof(struct page *) * nr_pages);
if (nvgpu_get_sgtable_from_pages(g, &sgt, pages, 0, if (nvgpu_get_sgtable_from_pages(g, &sgt, pages, 0,
nr_pages * PAGE_SIZE)) { nr_pages * PAGE_SIZE)) {

View File

@@ -701,7 +701,8 @@ static int nvgpu_pci_probe(struct pci_dev *pdev,
} }
/* copy detected device data to allocated platform space*/ /* copy detected device data to allocated platform space*/
memcpy((void *)platform, (void *)&nvgpu_pci_device[pent->driver_data], (void) memcpy((void *)platform,
(void *)&nvgpu_pci_device[pent->driver_data],
sizeof(struct gk20a_platform)); sizeof(struct gk20a_platform));
pci_set_drvdata(pdev, platform); pci_set_drvdata(pdev, platform);
@@ -778,7 +779,7 @@ static int nvgpu_pci_probe(struct pci_dev *pdev,
goto err_free_irq; goto err_free_irq;
} }
snprintf(nodefmt, sizeof(nodefmt), (void) snprintf(nodefmt, sizeof(nodefmt),
PCI_INTERFACE_NAME, dev_name(&pdev->dev)); PCI_INTERFACE_NAME, dev_name(&pdev->dev));
err = nvgpu_probe(g, "gpu_pci", nodefmt, &nvgpu_pci_class); err = nvgpu_probe(g, "gpu_pci", nodefmt, &nvgpu_pci_class);

View File

@@ -143,7 +143,7 @@ static int nvgpu_pci_parse_dev_name(const char *buf, size_t count, char *name)
if (ret < 4) if (ret < 4)
return -EINVAL; return -EINVAL;
snprintf(name, PCI_DEV_NAME_MAX, "%04x:%02x:%02x.%1x", (void) snprintf(name, PCI_DEV_NAME_MAX, "%04x:%02x:%02x.%1x",
domain, bus, device, func); domain, bus, device, func);
return 0; return 0;

View File

@@ -482,7 +482,7 @@ static int gk20a_tegra_get_clocks(struct device *dev)
BUG_ON(GK20A_CLKS_MAX < ARRAY_SIZE(tegra_gk20a_clocks)); BUG_ON(GK20A_CLKS_MAX < ARRAY_SIZE(tegra_gk20a_clocks));
snprintf(devname, sizeof(devname), "tegra_%s", dev_name(dev)); (void) snprintf(devname, sizeof(devname), "tegra_%s", dev_name(dev));
platform->num_clks = 0; platform->num_clks = 0;
for (i = 0; i < ARRAY_SIZE(tegra_gk20a_clocks); i++) { for (i = 0; i < ARRAY_SIZE(tegra_gk20a_clocks); i++) {
@@ -655,7 +655,7 @@ static struct clk *gk20a_clk_get(struct gk20a *g)
char clk_dev_id[32]; char clk_dev_id[32];
struct device *dev = dev_from_gk20a(g); struct device *dev = dev_from_gk20a(g);
snprintf(clk_dev_id, 32, "tegra_%s", dev_name(dev)); (void) snprintf(clk_dev_id, 32, "tegra_%s", dev_name(dev));
clk = clk_get_sys(clk_dev_id, "gpu"); clk = clk_get_sys(clk_dev_id, "gpu");
if (IS_ERR(clk)) { if (IS_ERR(clk)) {

View File

@@ -136,7 +136,7 @@ static int gk20a_sched_dev_ioctl_get_recent_tsgs(struct gk20a_sched_ctrl *sched,
return -EFAULT; return -EFAULT;
} }
memset(sched->recent_tsg_bitmap, 0, sched->bitmap_size); (void) memset(sched->recent_tsg_bitmap, 0, sched->bitmap_size);
nvgpu_mutex_release(&sched->status_lock); nvgpu_mutex_release(&sched->status_lock);
return 0; return 0;
@@ -418,9 +418,9 @@ int gk20a_sched_dev_open(struct inode *inode, struct file *filp)
goto free_ref; goto free_ref;
} }
memcpy(sched->recent_tsg_bitmap, sched->active_tsg_bitmap, (void) memcpy(sched->recent_tsg_bitmap, sched->active_tsg_bitmap,
sched->bitmap_size); sched->bitmap_size);
memset(sched->ref_tsg_bitmap, 0, sched->bitmap_size); (void) memset(sched->ref_tsg_bitmap, 0, sched->bitmap_size);
filp->private_data = sched; filp->private_data = sched;
nvgpu_log(g, gpu_dbg_sched, "filp=%p sched=%p", filp, sched); nvgpu_log(g, gpu_dbg_sched, "filp=%p sched=%p", filp, sched);
@@ -447,7 +447,7 @@ long gk20a_sched_dev_ioctl(struct file *filp, unsigned int cmd,
(_IOC_SIZE(cmd) > NVGPU_SCHED_IOCTL_MAX_ARG_SIZE)) (_IOC_SIZE(cmd) > NVGPU_SCHED_IOCTL_MAX_ARG_SIZE))
return -EINVAL; return -EINVAL;
memset(buf, 0, sizeof(buf)); (void) memset(buf, 0, sizeof(buf));
if (_IOC_DIR(cmd) & _IOC_WRITE) { if (_IOC_DIR(cmd) & _IOC_WRITE) {
if (copy_from_user(buf, (void __user *)arg, _IOC_SIZE(cmd))) if (copy_from_user(buf, (void __user *)arg, _IOC_SIZE(cmd)))
return -EFAULT; return -EFAULT;

View File

@@ -276,7 +276,7 @@ static void gk20a_sync_timeline_value_str(struct sync_timeline *timeline,
{ {
struct gk20a_sync_timeline *obj = struct gk20a_sync_timeline *obj =
(struct gk20a_sync_timeline *)timeline; (struct gk20a_sync_timeline *)timeline;
snprintf(str, size, "%d", gk20a_sync_timeline_current(obj)); (void) snprintf(str, size, "%d", gk20a_sync_timeline_current(obj));
} }
static void gk20a_sync_pt_value_str_for_sema(struct gk20a_sync_pt *pt, static void gk20a_sync_pt_value_str_for_sema(struct gk20a_sync_pt *pt,
@@ -284,7 +284,7 @@ static void gk20a_sync_pt_value_str_for_sema(struct gk20a_sync_pt *pt,
{ {
struct nvgpu_semaphore *s = pt->sema; struct nvgpu_semaphore *s = pt->sema;
snprintf(str, size, "S: pool=%llu [v=%u,r_v=%u]", (void) snprintf(str, size, "S: pool=%llu [v=%u,r_v=%u]",
s->location.pool->page_idx, s->location.pool->page_idx,
nvgpu_semaphore_get_value(s), nvgpu_semaphore_get_value(s),
nvgpu_semaphore_read(s)); nvgpu_semaphore_read(s));
@@ -300,7 +300,7 @@ static void gk20a_sync_pt_value_str(struct sync_pt *sync_pt, char *str,
return; return;
} }
snprintf(str, size, "%d", pt->thresh); (void) snprintf(str, size, "%d", pt->thresh);
} }
static const struct sync_timeline_ops gk20a_sync_timeline_ops = { static const struct sync_timeline_ops gk20a_sync_timeline_ops = {
@@ -406,7 +406,7 @@ struct sync_fence *gk20a_sync_fence_create(
return NULL; return NULL;
va_start(args, fmt); va_start(args, fmt);
vsnprintf(name, sizeof(name), fmt, args); (void) vsnprintf(name, sizeof(name), fmt, args);
va_end(args); va_end(args);
fence = sync_fence_create(name, pt); fence = sync_fence_create(name, pt);

View File

@@ -655,7 +655,7 @@ static ssize_t aelpg_param_store(struct device *dev,
/* If parameter value is 0 then reset to SW default values*/ /* If parameter value is 0 then reset to SW default values*/
if ((paramlist[0] | paramlist[1] | paramlist[2] if ((paramlist[0] | paramlist[1] | paramlist[2]
| paramlist[3] | paramlist[4]) == 0x00) { | paramlist[3] | paramlist[4]) == 0x00) {
memcpy(paramlist, defaultparam, sizeof(defaultparam)); (void) memcpy(paramlist, defaultparam, sizeof(defaultparam));
} }
/* If aelpg is enabled & pmu is ready then post values to /* If aelpg is enabled & pmu is ready then post values to

View File

@@ -61,7 +61,7 @@ int nvgpu_timeout_init(struct gk20a *g, struct nvgpu_timeout *timeout,
if (flags & ~NVGPU_TIMER_FLAG_MASK) if (flags & ~NVGPU_TIMER_FLAG_MASK)
return -EINVAL; return -EINVAL;
memset(timeout, 0, sizeof(*timeout)); (void) memset(timeout, 0, sizeof(*timeout));
timeout->g = g; timeout->g = g;
timeout->flags = flags; timeout->flags = flags;
@@ -89,7 +89,7 @@ static int __nvgpu_timeout_expired_msg_cpu(struct nvgpu_timeout *timeout,
if (!(timeout->flags & NVGPU_TIMER_SILENT_TIMEOUT)) { if (!(timeout->flags & NVGPU_TIMER_SILENT_TIMEOUT)) {
char buf[128]; char buf[128];
vsnprintf(buf, sizeof(buf), fmt, args); (void) vsnprintf(buf, sizeof(buf), fmt, args);
nvgpu_err(g, "Timeout detected @ %pF %s", caller, buf); nvgpu_err(g, "Timeout detected @ %pF %s", caller, buf);
} }
@@ -113,7 +113,7 @@ static int __nvgpu_timeout_expired_msg_retry(struct nvgpu_timeout *timeout,
if (!(timeout->flags & NVGPU_TIMER_SILENT_TIMEOUT)) { if (!(timeout->flags & NVGPU_TIMER_SILENT_TIMEOUT)) {
char buf[128]; char buf[128];
vsnprintf(buf, sizeof(buf), fmt, args); (void) vsnprintf(buf, sizeof(buf), fmt, args);
nvgpu_err(g, "No more retries @ %pF %s", caller, buf); nvgpu_err(g, "No more retries @ %pF %s", caller, buf);
} }

View File

@@ -211,7 +211,7 @@ int vgpu_fecs_trace_set_filter(struct gk20a *g,
struct tegra_vgpu_fecs_trace_filter *p = &msg.params.fecs_trace_filter; struct tegra_vgpu_fecs_trace_filter *p = &msg.params.fecs_trace_filter;
int err; int err;
memcpy(&p->tag_bits, &filter->tag_bits, sizeof(p->tag_bits)); (void) memcpy(&p->tag_bits, &filter->tag_bits, sizeof(p->tag_bits));
err = vgpu_comm_sendrecv(&msg, sizeof(msg), sizeof(msg)); err = vgpu_comm_sendrecv(&msg, sizeof(msg), sizeof(msg));
err = err ? err : msg.ret; err = err ? err : msg.ret;
WARN_ON(err); WARN_ON(err);

View File

@@ -2245,8 +2245,10 @@ struct nvgpu_ctxsw_ring_setup_args {
((p)->tag_bits[(n) / 64] &= ~(1 << ((n) & 63))) ((p)->tag_bits[(n) / 64] &= ~(1 << ((n) & 63)))
#define NVGPU_CTXSW_FILTER_ISSET(n, p) \ #define NVGPU_CTXSW_FILTER_ISSET(n, p) \
((p)->tag_bits[(n) / 64] & (1 << ((n) & 63))) ((p)->tag_bits[(n) / 64] & (1 << ((n) & 63)))
#define NVGPU_CTXSW_FILTER_CLR_ALL(p) memset((void *)(p), 0, sizeof(*(p))) #define NVGPU_CTXSW_FILTER_CLR_ALL(p) \
#define NVGPU_CTXSW_FILTER_SET_ALL(p) memset((void *)(p), ~0, sizeof(*(p))) ((void) memset((void *)(p), 0, sizeof(*(p))))
#define NVGPU_CTXSW_FILTER_SET_ALL(p) \
((void) memset((void *)(p), ~0, sizeof(*(p))))
struct nvgpu_ctxsw_trace_filter { struct nvgpu_ctxsw_trace_filter {
__u64 tag_bits[(NVGPU_CTXSW_FILTER_SIZE + 63) / 64]; __u64 tag_bits[(NVGPU_CTXSW_FILTER_SIZE + 63) / 64];