2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-22 09:58:09 +00:00

amdgpu_plugin: fix lint errors

$ make lint
 ...
 # Do not append \n to pr_perror, pr_pwarn or fail
 ! git --no-pager grep -E '^\s*\<(pr_perror|pr_pwarn|fail)\>.*\\n"'
 plugins/amdgpu/amdgpu_plugin.c:		pr_perror("%s(), Can't handle VMAs of input device\n", __func__);

 ! git --no-pager grep -En '^\s*\<pr_(err|warn|msg|info|debug)\>.*);$' | grep -v '\\n'
 plugins/amdgpu/amdgpu_plugin_drm.c:45:		pr_err("Error in getting stat for: %s", path);
 plugins/amdgpu/amdgpu_plugin_util.c:77:		pr_err("Unable to read file (read:%ld buf_len:%ld)", len_read, buf_len);
 plugins/amdgpu/amdgpu_plugin_util.c:89:		pr_err("Unable to write file (wrote:%ld buf_len:%ld)", len_write, buf_len);
 plugins/amdgpu/amdgpu_plugin_util.c:120:		pr_err("%s: Failed to open for %s", path, write ? "write" : "read");
 plugins/amdgpu/amdgpu_plugin_util.c:126:		pr_err("%s: Failed get pointer for %s", path, write ? "write" : "read");
 plugins/amdgpu/amdgpu_plugin_util.c:136:		pr_err("%s:Failed to access file size", path);
 plugins/amdgpu/amdgpu_plugin_util.c:152:		pr_err("Cannot fopen %s", file_path);

 make: *** [Makefile:470: lint] Error 1

Signed-off-by: Radostin Stoyanov <rstoyanov@fedoraproject.org>
This commit is contained in:
Radostin Stoyanov 2024-02-09 14:14:10 +00:00 committed by Andrei Vagin
parent bd17bd43e3
commit a808f09bea
3 changed files with 9 additions and 12 deletions

View File

@ -412,7 +412,7 @@ int amdgpu_plugin_handle_device_vma(int fd, const struct stat *st_buf)
/* Determine if input is a DRM device and therefore is supported */ /* Determine if input is a DRM device and therefore is supported */
ret = amdgpu_plugin_drm_handle_device_vma(fd, st_buf); ret = amdgpu_plugin_drm_handle_device_vma(fd, st_buf);
if (ret) if (ret)
pr_perror("%s(), Can't handle VMAs of input device\n", __func__); pr_perror("%s(), Can't handle VMAs of input device", __func__);
return ret; return ret;
} }

View File

@ -42,7 +42,7 @@ int amdgpu_plugin_drm_handle_device_vma(int fd, const struct stat *st)
snprintf(path, sizeof(path), AMDGPU_DRM_DEVICE, DRM_FIRST_RENDER_NODE); snprintf(path, sizeof(path), AMDGPU_DRM_DEVICE, DRM_FIRST_RENDER_NODE);
ret = stat(path, &drm); ret = stat(path, &drm);
if (ret == -1) { if (ret == -1) {
pr_err("Error in getting stat for: %s", path); pr_err("Error in getting stat for: %s\n", path);
return ret; return ret;
} }
@ -98,4 +98,3 @@ int amdgpu_plugin_drm_dump_file(int fd, int id, struct stat *drm)
xfree(buf); xfree(buf);
return ret; return ret;
} }

View File

@ -65,7 +65,7 @@ void init_gpu_count(struct tp_system *topo)
return; return;
/* We add ONE to include checkpointing of KFD device */ /* We add ONE to include checkpointing of KFD device */
dev_file_cnt = 1 + topology_gpu_count(topo); dev_file_cnt = 1 + topology_gpu_count(topo);
} }
int read_fp(FILE *fp, void *buf, const size_t buf_len) int read_fp(FILE *fp, void *buf, const size_t buf_len)
@ -74,7 +74,7 @@ int read_fp(FILE *fp, void *buf, const size_t buf_len)
len_read = fread(buf, 1, buf_len, fp); len_read = fread(buf, 1, buf_len, fp);
if (len_read != buf_len) { if (len_read != buf_len) {
pr_err("Unable to read file (read:%ld buf_len:%ld)", len_read, buf_len); pr_err("Unable to read file (read:%ld buf_len:%ld)\n", len_read, buf_len);
return -EIO; return -EIO;
} }
return 0; return 0;
@ -86,7 +86,7 @@ int write_fp(FILE *fp, const void *buf, const size_t buf_len)
len_write = fwrite(buf, 1, buf_len, fp); len_write = fwrite(buf, 1, buf_len, fp);
if (len_write != buf_len) { if (len_write != buf_len) {
pr_err("Unable to write file (wrote:%ld buf_len:%ld)", len_write, buf_len); pr_err("Unable to write file (wrote:%ld buf_len:%ld)\n", len_write, buf_len);
return -EIO; return -EIO;
} }
return 0; return 0;
@ -117,13 +117,13 @@ FILE *open_img_file(char *path, bool write, size_t *size)
fd = openat(criu_get_image_dir(), path, write ? (O_WRONLY | O_CREAT) : O_RDONLY, 0600); fd = openat(criu_get_image_dir(), path, write ? (O_WRONLY | O_CREAT) : O_RDONLY, 0600);
if (fd < 0) { if (fd < 0) {
pr_err("%s: Failed to open for %s", path, write ? "write" : "read"); pr_err("%s: Failed to open for %s\n", path, write ? "write" : "read");
return NULL; return NULL;
} }
fp = fdopen(fd, write ? "w" : "r"); fp = fdopen(fd, write ? "w" : "r");
if (!fp) { if (!fp) {
pr_err("%s: Failed get pointer for %s", path, write ? "write" : "read"); pr_err("%s: Failed get pointer for %s\n", path, write ? "write" : "read");
return NULL; return NULL;
} }
@ -133,7 +133,7 @@ FILE *open_img_file(char *path, bool write, size_t *size)
ret = read_fp(fp, size, sizeof(*size)); ret = read_fp(fp, size, sizeof(*size));
if (ret) { if (ret) {
pr_err("%s:Failed to access file size", path); pr_err("%s:Failed to access file size\n", path);
fclose(fp); fclose(fp);
return NULL; return NULL;
} }
@ -149,7 +149,7 @@ int read_file(const char *file_path, void *buf, const size_t buf_len)
fp = fopen(file_path, "r"); fp = fopen(file_path, "r");
if (!fp) { if (!fp) {
pr_err("Cannot fopen %s", file_path); pr_err("Cannot fopen %s\n", file_path);
return -errno; return -errno;
} }
@ -204,5 +204,3 @@ void print_kfd_bo_stat(int bo_cnt, struct kfd_criu_bo_bucket *bo_list)
} }
pr_info("\n"); pr_info("\n");
} }