From cdbe8d1fc123c93a0bbf0bf329a3f8f94ac8c2fa Mon Sep 17 00:00:00 2001 From: Deepak Nibade Date: Wed, 25 Feb 2015 18:15:15 +0530 Subject: gpu: nvgpu: use correct API to check valid syncpt Below check assumes that available syncpt range starts from 0 id >= nvhost_syncpt_nb_pts_ext() Instead of using this API, use nvhost_syncpt_is_valid_pt_ext() which validates the syncpt id against both upper and lower boundaries Bug 1611482 Change-Id: I7c4465a2bc84b63fefaa17c64f02582885924c5e Signed-off-by: Deepak Nibade Reviewed-on: http://git-master/r/711211 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Terje Bergstrom Reviewed-by: Arto Merilainen --- drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.c b/drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.c index 631813ae..73b2d7ec 100644 --- a/drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.c @@ -3,7 +3,7 @@ * * GK20A Channel Synchronization Abstraction * - * Copyright (c) 2014, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2014-2015, NVIDIA CORPORATION. All rights reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, @@ -61,7 +61,7 @@ static int gk20a_channel_syncpt_wait_syncpt(struct gk20a_channel_sync *s, container_of(s, struct gk20a_channel_syncpt, ops); struct priv_cmd_entry *wait_cmd = NULL; - if (id >= nvhost_syncpt_nb_pts_ext(sp->host1x_pdev)) { + if (!nvhost_syncpt_is_valid_pt_ext(sp->host1x_pdev, id)) { dev_warn(dev_from_gk20a(sp->c->g), "invalid wait id in gpfifo submit, elided"); return 0; @@ -105,8 +105,8 @@ static int gk20a_channel_syncpt_wait_fd(struct gk20a_channel_sync *s, int fd, for (i = 0; i < sync_fence->num_fences; i++) { struct sync_pt *pt = sync_pt_from_fence(sync_fence->cbs[i].sync_pt); u32 wait_id = nvhost_sync_pt_id(pt); - if (!wait_id || - wait_id >= nvhost_syncpt_nb_pts_ext(sp->host1x_pdev)) { + if (!wait_id || !nvhost_syncpt_is_valid_pt_ext(sp->host1x_pdev, + wait_id)) { sync_fence_put(sync_fence); return -EINVAL; } -- cgit v1.2.2