diff options
author | Thierry Reding <treding@nvidia.com> | 2018-02-28 15:20:24 +0100 |
---|---|---|
committer | Thierry Reding <treding@nvidia.com> | 2018-05-02 17:29:39 +0200 |
commit | 76d90d97db5c2e5c6091e8e18ac3b7dc6a95cd74 (patch) | |
tree | fdde26b2ae3e870f4f975f390c0950d2b6ac5822 | |
parent | 0516be76b91d72c887412cbc7643b7cd48814d76 (diff) |
freedreno: Avoid dereferencing type-punned pointer
Use proper types directly rather than casts to avoid warnings from GCC
about potentially breaking strict-aliasing rules:
freedreno/freedreno_bo.c: In function 'lookup_bo':
freedreno/freedreno_bo.c:51:2: warning: dereferencing type-punned pointer might break strict-aliasing rules [-Wstrict-aliasing]
if (!drmHashLookup(tbl, key, (void **)&bo)) {
^~
Signed-off-by: Thierry Reding <treding@nvidia.com>
-rw-r--r-- | freedreno/freedreno_bo.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/freedreno/freedreno_bo.c b/freedreno/freedreno_bo.c index 34c285fb..be85c386 100644 --- a/freedreno/freedreno_bo.c +++ b/freedreno/freedreno_bo.c @@ -44,9 +44,10 @@ static void set_name(struct fd_bo *bo, uint32_t name) static struct fd_bo * lookup_bo(void *tbl, uint32_t key) { struct fd_bo *bo = NULL; - if (!drmHashLookup(tbl, key, (void **)&bo)) { + void *value; + if (!drmHashLookup(tbl, key, &value)) { /* found, incr refcnt and return: */ - bo = fd_bo_ref(bo); + bo = fd_bo_ref(value); /* don't break the bucket if this bo was found in one */ list_delinit(&bo->list); |