From patchwork Fri Dec 3 07:04:18 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Yingliang X-Patchwork-Id: 12654393 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E5594C433EF for ; Fri, 3 Dec 2021 06:57:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378727AbhLCHBF (ORCPT ); Fri, 3 Dec 2021 02:01:05 -0500 Received: from szxga01-in.huawei.com ([45.249.212.187]:32874 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345605AbhLCHBF (ORCPT ); Fri, 3 Dec 2021 02:01:05 -0500 Received: from dggpeml500023.china.huawei.com (unknown [172.30.72.53]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4J53Y74W81zcbgT; Fri, 3 Dec 2021 14:57:31 +0800 (CST) Received: from dggpeml500017.china.huawei.com (7.185.36.243) by dggpeml500023.china.huawei.com (7.185.36.114) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20; Fri, 3 Dec 2021 14:57:40 +0800 Received: from huawei.com (10.175.103.91) by dggpeml500017.china.huawei.com (7.185.36.243) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20; Fri, 3 Dec 2021 14:57:39 +0800 From: Yang Yingliang To: , CC: , , , Subject: [PATCH -next] net: prestera: acl: fix return value check in prestera_acl_rule_entry_find() Date: Fri, 3 Dec 2021 15:04:18 +0800 Message-ID: <20211203070418.465144-1-yangyingliang@huawei.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Originating-IP: [10.175.103.91] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To dggpeml500017.china.huawei.com (7.185.36.243) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org 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 Signed-off-by: Yang Yingliang --- drivers/net/ethernet/marvell/prestera/prestera_acl.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/marvell/prestera/prestera_acl.c b/drivers/net/ethernet/marvell/prestera/prestera_acl.c index da0b6525ef9a..fc7f2fedafd7 100644 --- a/drivers/net/ethernet/marvell/prestera/prestera_acl.c +++ b/drivers/net/ethernet/marvell/prestera/prestera_acl.c @@ -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,