rhashtable: Use rht_obj() instead of manual offset calculation
authorThomas Graf <tgraf@suug.ch>
Fri, 2 Jan 2015 22:00:15 +0000 (23:00 +0100)
committerDavid S. Miller <davem@davemloft.net>
Sat, 3 Jan 2015 19:32:56 +0000 (14:32 -0500)
Signed-off-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
lib/rhashtable.c

index 1ee0eb6..b658245 100644 (file)
@@ -427,7 +427,7 @@ void *rhashtable_lookup(const struct rhashtable *ht, const void *key)
                if (memcmp(rht_obj(ht, he) + ht->p.key_offset, key,
                           ht->p.key_len))
                        continue;
-               return (void *) he - ht->p.head_offset;
+               return rht_obj(ht, he);
        }
 
        return NULL;
@@ -460,7 +460,7 @@ void *rhashtable_lookup_compare(const struct rhashtable *ht, const void *key,
        rht_for_each_rcu(he, tbl->buckets[hash], ht) {
                if (!compare(rht_obj(ht, he), arg))
                        continue;
-               return (void *) he - ht->p.head_offset;
+               return rht_obj(ht, he);
        }
 
        return NULL;