v3dv: check returned values

Check if v3dv_ioctl() or v3dv_bo_map() fail, and print a proper error
message.

This check happens in the rest of the code, so it makes sense to apply
here too.

Fixes CID#1468162 "Unchecked return value (CHECKED_RETURN)".

v2:
 - Fix message error (Iago)

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10380>
This commit is contained in:
Juan A. Suarez Romero
2021-04-21 17:23:57 +02:00
committed by Marge Bot
parent 32a2978949
commit 796cb1e9d5
2 changed files with 10 additions and 2 deletions
+3 -1
View File
@@ -1546,7 +1546,9 @@ device_free_wsi_dumb(int32_t display_fd, int32_t dumb_handle)
struct drm_mode_destroy_dumb destroy_dumb = {
.handle = dumb_handle,
};
v3dv_ioctl(display_fd, DRM_IOCTL_MODE_DESTROY_DUMB, &destroy_dumb);
if (v3dv_ioctl(display_fd, DRM_IOCTL_MODE_DESTROY_DUMB, &destroy_dumb)) {
fprintf(stderr, "destroy dumb object %d: %s\n", dumb_handle, strerror(errno));
}
}
static void
+7 -1
View File
@@ -46,7 +46,12 @@ v3dv_clif_dump(struct v3dv_device *device,
char *name = ralloc_asprintf(NULL, "%s_0x%x",
bo->name, bo->offset);
v3dv_bo_map(device, bo, bo->size);
bool ok = v3dv_bo_map(device, bo, bo->size);
if (!ok) {
fprintf(stderr, "failed to map BO for clif_dump.\n");
ralloc_free(name);
goto free_clif;
}
clif_dump_add_bo(clif, name, bo->offset, bo->size, bo->map);
ralloc_free(name);
@@ -54,6 +59,7 @@ v3dv_clif_dump(struct v3dv_device *device,
clif_dump(clif, submit);
free_clif:
clif_dump_destroy(clif);
}