net: prestera: acl: fix return value check in prestera_acl_rule_entry_find()
authorYang Yingliang <yangyingliang@huawei.com>
Fri, 3 Dec 2021 07:04:18 +0000 (15:04 +0800)
committerDavid S. Miller <davem@davemloft.net>
Fri, 3 Dec 2021 14:19:54 +0000 (14:19 +0000)
rhashtable_lookup_fast() returns NULL pointer not ERR_PTR().
Return rhashtable_lookup_fast() directly to fix this.

Fixes: 47327e198d42 ("net: prestera: acl: migrate to new vTCAM api")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/marvell/prestera/prestera_acl.c

index da0b6525ef9a98e3d54d608f4863bf6d746b35e7..fc7f2fedafd7c598c9ebdb1fd02820dad72466c7 100644 (file)
@@ -419,11 +419,8 @@ struct prestera_acl_rule_entry *
 prestera_acl_rule_entry_find(struct prestera_acl *acl,
                             struct prestera_acl_rule_entry_key *key)
 {
-       struct prestera_acl_rule_entry *e;
-
-       e = rhashtable_lookup_fast(&acl->acl_rule_entry_ht, key,
-                                  __prestera_acl_rule_entry_ht_params);
-       return IS_ERR(e) ? NULL : e;
+       return rhashtable_lookup_fast(&acl->acl_rule_entry_ht, key,
+                                     __prestera_acl_rule_entry_ht_params);
 }
 
 static int __prestera_acl_rule_entry2hw_del(struct prestera_switch *sw,