drm/msm: Safely skip holes in the counter group lists
For backwards compatibility the counter group list has some built in gaps that return NULL when queried. Make sure that all the functions that query the list are able to handle a NULL pointer. Change-Id: Ic0dedbadd10ccf3a3b9b1f1b035a46a4f7ee8493 Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
This commit is contained in:
parent
00ca56e448
commit
095e8c4885
1 changed files with 3 additions and 3 deletions
|
@ -721,7 +721,7 @@ static struct adreno_counter_group *get_counter_group(struct msm_gpu *gpu,
|
|||
return ERR_PTR(-ENODEV);
|
||||
|
||||
if (groupid >= adreno_gpu->nr_counter_groups)
|
||||
return ERR_PTR(-EINVAL);
|
||||
return ERR_PTR(-ENODEV);
|
||||
|
||||
return (struct adreno_counter_group *)
|
||||
adreno_gpu->counter_groups[groupid];
|
||||
|
@ -744,7 +744,7 @@ u64 adreno_read_counter(struct msm_gpu *gpu, u32 groupid, int counterid)
|
|||
struct adreno_counter_group *group =
|
||||
get_counter_group(gpu, groupid);
|
||||
|
||||
if (!IS_ERR(group) && group->funcs.read)
|
||||
if (!IS_ERR_OR_NULL(group) && group->funcs.read)
|
||||
return group->funcs.read(gpu, group, counterid);
|
||||
|
||||
return 0;
|
||||
|
@ -755,6 +755,6 @@ void adreno_put_counter(struct msm_gpu *gpu, u32 groupid, int counterid)
|
|||
struct adreno_counter_group *group =
|
||||
get_counter_group(gpu, groupid);
|
||||
|
||||
if (!IS_ERR(group) && group->funcs.put)
|
||||
if (!IS_ERR_OR_NULL(group) && group->funcs.put)
|
||||
group->funcs.put(gpu, group, counterid);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue