From patchwork Thu May 16 09:24:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chen Ni X-Patchwork-Id: 13665947 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 923D8C25B74 for ; Thu, 16 May 2024 09:32:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=1fERGu5UnVnOLutdcAx9jw1b8OnFekbAmVYotJyZzaQ=; b=Qug9TOBPNDHYWu5Om/yEtPO0ck xm9akEHZ9crlOArSLH+bnviUCxIVAK37RIccVWnh+sOVtUmscmGWN5y4zXgIGc2MsylA638rWQJ7e N5HSycrhg7JRM+Ohht0vIwRd1s7WNU22qvpqhpKmfhsmOaZazCXkmxCxeTPz7rv/Y1c6Duv7uHDBw bvdQfQZZRBL1v+Ut34DXCQfI7Avh3oeEHwS86B2iBAq4HohT+A/XbE4tUJst0i3pWJvLo7ea0jlbc 2NcyG3NFZc3pQG1tfQGlGPNum91IP/pb1X3oPkIqWwBmrgkMPoAt8SFZG+ms0iAtqJR5nnBo8NYLG gkiqldyg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s7XTr-00000004KLz-01Ne; Thu, 16 May 2024 09:32:55 +0000 Received: from smtp81.cstnet.cn ([159.226.251.81] helo=cstnet.cn) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s7XTm-00000004KK3-3qZr; Thu, 16 May 2024 09:32:53 +0000 Received: from localhost (unknown [124.16.138.129]) by APP-03 (Coremail) with SMTP id rQCowABXX5uo0kVm5IRaCw--.4321S2; Thu, 16 May 2024 17:32:25 +0800 (CST) From: Chen Ni To: nbd@nbd.name, sean.wang@mediatek.com, Mark-MC.Lee@mediatek.com, lorenzo@kernel.org, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, matthias.bgg@gmail.com, angelogioacchino.delregno@collabora.com Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, Chen Ni Subject: [PATCH net-next] net: ethernet: mtk_eth_soc: add missing check for rhashtable_init Date: Thu, 16 May 2024 17:24:27 +0800 Message-Id: <20240516092427.3897322-1-nichen@iscas.ac.cn> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-CM-TRANSID: rQCowABXX5uo0kVm5IRaCw--.4321S2 X-Coremail-Antispam: 1UD129KBjvdXoW7Jr48Aw13Wr4xGFyDuw1xKrg_yoWkAFcEgr Z2v3W3G3yUKryFka12kF4j9rWFkF4kJw18ZFZ3tFZIqry7GF1UAry09r9xWFZ7Ww1kAasr JrnIqa4xC34UGjkaLaAFLSUrUUUUjb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUIcSsGvfJTRUUUbx8FF20E14v26r4j6ryUM7CY07I20VC2zVCF04k26cxKx2IYs7xG 6rWj6s0DM7CIcVAFz4kK6r1j6r18M28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48ve4kI8w A2z4x0Y4vE2Ix0cI8IcVAFwI0_tr0E3s1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI0_Gr1j 6F4UJwA2z4x0Y4vEx4A2jsIE14v26rxl6s0DM28EF7xvwVC2z280aVCY1x0267AKxVW0oV Cq3wAS0I0E0xvYzxvE52x082IY62kv0487Mc02F40EFcxC0VAKzVAqx4xG6I80ewAv7VC0 I7IYx2IY67AKxVWUJVWUGwAv7VC2z280aVAFwI0_Jr0_Gr1lOx8S6xCaFVCjc4AY6r1j6r 4UM4x0Y48IcxkI7VAKI48JM4x0x7Aq67IIx4CEVc8vx2IErcIFxwACI402YVCY1x02628v n2kIc2xKxwCF04k20xvY0x0EwIxGrwCFx2IqxVCFs4IE7xkEbVWUJVW8JwC20s026c02F4 0E14v26r1j6r18MI8I3I0E7480Y4vE14v26r106r1rMI8E67AF67kF1VAFwI0_Jw0_GFyl IxkGc2Ij64vIr41lIxAIcVC0I7IYx2IY67AKxVWUJVWUCwCI42IY6xIIjxv20xvEc7CjxV AFwI0_Gr0_Cr1lIxAIcVCF04k26cxKx2IYs7xG6r1j6r1xMIIF0xvEx4A2jsIE14v26r1j 6r4UMIIF0xvEx4A2jsIEc7CjxVAFwI0_Gr0_Gr1UYxBIdaVFxhVjvjDU0xZFpf9x0JUdHU DUUUUU= X-Originating-IP: [124.16.138.129] X-CM-SenderInfo: xqlfxv3q6l2u1dvotugofq/ X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240516_023251_396685_0A9C6C0D X-CRM114-Status: GOOD ( 10.73 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org Add check for the return value of rhashtable_init() and return the error if it fails in order to catch the error. Fixes: 33fc42de3327 ("net: ethernet: mtk_eth_soc: support creating mac address based offload entries") Signed-off-by: Chen Ni --- drivers/net/ethernet/mediatek/mtk_ppe.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/mediatek/mtk_ppe.c b/drivers/net/ethernet/mediatek/mtk_ppe.c index 0acee405a749..f7e5e6e52cdf 100644 --- a/drivers/net/ethernet/mediatek/mtk_ppe.c +++ b/drivers/net/ethernet/mediatek/mtk_ppe.c @@ -884,12 +884,15 @@ struct mtk_ppe *mtk_ppe_init(struct mtk_eth *eth, void __iomem *base, int index) struct mtk_ppe *ppe; u32 foe_flow_size; void *foe; + int ret; ppe = devm_kzalloc(dev, sizeof(*ppe), GFP_KERNEL); if (!ppe) return NULL; - rhashtable_init(&ppe->l2_flows, &mtk_flow_l2_ht_params); + ret = rhashtable_init(&ppe->l2_flows, &mtk_flow_l2_ht_params); + if (ret) + return NULL; /* need to allocate a separate device, since it PPE DMA access is * not coherent.