Received: by 2002:ab2:6816:0:b0:1f9:5764:f03e with SMTP id t22csp169507lqo; Thu, 16 May 2024 02:44:01 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX9lGvqXBGhyBNNWyD+4qTMTVhDxxzYAL82GwlkSMBNt1riBfdYhSgJ+zKcb8jHARI+jymiVm+xPN6qinwmsnopIZ3huxf4EDQC12avnA== X-Google-Smtp-Source: AGHT+IHHC5RUtQVPg9xkUmj5MvqA/AGbEYULIHb7Hn3yUd/e5R01+wDlqnEFVnu3KTQygWmYv3F1 X-Received: by 2002:a05:622a:5b95:b0:43a:4ad9:51e5 with SMTP id d75a77b69052e-43dfcc66e69mr315753391cf.5.1715852640754; Thu, 16 May 2024 02:44:00 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715852640; cv=pass; d=google.com; s=arc-20160816; b=jctk4gkqtWKosYpuLvMGVJfBtkAhPAaLzuxQo+aGVtA5NNwJ2vIyMxHxV7/Y6Jcrjf 7iyWpnMIPF1IsyQTjJqlIWWuAFraq1mv6HWNYNbjNRrBllQYKMUG3fBr2TCUrp1sOyXD Q9BLWHrhrLNW8RCe2OS14WmJ1Yas4hBTATjVFtEGzyN9n/kEc5b9FF9e+IMas0/eAfNr YuFSbx7YRfgJMKGCXri729iGmUQJPZGXzi3NfeB/2jkoY6Kouc3RF2nD/yKxDjIMR9rT XWipI4M/p8uhmnQbnf/uk8Mmj7VjRwY8FLd8XlKrTRKI0Qv7a6SZEk+lVrWsNBEuNBmK uyuQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from; bh=1fERGu5UnVnOLutdcAx9jw1b8OnFekbAmVYotJyZzaQ=; fh=W8Gm+mBu2g+tyiFm4N/fTrMi+4OqO8jmSbzk/h3k6iQ=; b=FYcAXvs46rqKuDLuTU5M5j1qrUxcCgdjbhNLBov107/D8X2CIAGw9I4Pzj9pk2+sYC Bt0jDTWJQVQduneoA8YspPGKvxslBaBSJw/6yvLqDhQ3XYoDPQj1/e8TOnvml/qlvRlW mq0/zGByJi4TuSwZ48qMw7/I7xuwL7p7mNO1wDFt3VENZ5hqjS7EgNzXnTNz5co/gS59 DAksbnZHa1S3+ViGSBQCWkWfxvrFsYVbKTMo6EDZzyyO81PQT3+YVMrQ1wx+mDdc7l9l V18lEXZmOgLfOrNF16vKVIuuhYY1btqV4u3qvywmd9Ait96zTmwFiJFhLlJ0hT/K7egQ Qx1A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=iscas.ac.cn); spf=pass (google.com: domain of linux-kernel+bounces-180858-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-180858-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id d75a77b69052e-43df56b3365si160644731cf.596.2024.05.16.02.44.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 May 2024 02:44:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-180858-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=iscas.ac.cn); spf=pass (google.com: domain of linux-kernel+bounces-180858-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-180858-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id B10731C237D4 for ; Thu, 16 May 2024 09:43:22 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D8A67143882; Thu, 16 May 2024 09:43:07 +0000 (UTC) Received: from cstnet.cn (smtp81.cstnet.cn [159.226.251.81]) (using TLSv1.2 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5A3344206C; Thu, 16 May 2024 09:43:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=159.226.251.81 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715852587; cv=none; b=sGJneFMTOTs+Qu/5MWLAvW6a7Z+xtcJApDU1yUuQgrfjarJ2JCaVu7QtSJG+dv73P6JLNlRzl5j39+mnL6CK/lzgdDr0mA1OQvg7LGI3nhZKuZtqf4/qJCf1QeQ2RfSgeW78y/fLGxBUPwdd7dfW44qFL/qIiQRABWnuqj7llCg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715852587; c=relaxed/simple; bh=neiYi9rz56JelB8LT1Vt63mxobtiMVPaYMXphegGdds=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=AHRRSLaSAX1cEs6q0rNYcm+51NEGL//zzZprVaCaiDfKpVpQQGONUJp71UBf9Es1Zf1kZyL3BnOaq4SbdJ9eEe4VyJXtKOTorfkNjJz2y+RkTQVCDGJJnJpl8pHRwlZp7AhHoG8qW5ARK9UF0XSVsmgpJg1U1o//WZFBiDPfPkQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=iscas.ac.cn; spf=pass smtp.mailfrom=iscas.ac.cn; arc=none smtp.client-ip=159.226.251.81 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=iscas.ac.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=iscas.ac.cn 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 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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-CM-SenderInfo: xqlfxv3q6l2u1dvotugofq/ 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. -- 2.25.1