Received: by 2002:a89:d88:0:b0:1fa:5c73:8e2d with SMTP id eb8csp2332414lqb; Mon, 27 May 2024 16:43:01 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXyaZ/R12eq2BkqLpxRCOkX5RyIYp3Ykh//AOoEdi3oK7jJVS/Bo/LYFiGfnW3IA6FDa9SjYm+SBH2r3vDnZXwqLXj35JD7gpa4qCp+Pw== X-Google-Smtp-Source: AGHT+IE4nErbGrIVvwVT27XGFl/7GvtqAXFxLjhIp4otJlS8Pfet87g++nfh2cE0Ri+IyuoncwWJ X-Received: by 2002:a05:6512:31cc:b0:529:b9dc:2ffa with SMTP id 2adb3069b0e04-529b9dc3041mr309116e87.17.1716853381584; Mon, 27 May 2024 16:43:01 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716853381; cv=pass; d=google.com; s=arc-20160816; b=KyPR2SAbNLEmKCAiQ1bEVcP8TbpR6EX+oZ/XGvwfWzbvxGhUk1f/7AzYK6V5oCkLVd 7BmWeV5cXImzVIR+c4pSvT4NN0TjzW2acl7wRz/zm1WkpDWN/5bY7Qgq+Iuhji3cxCHP dQEFHFO/S6eiB1WKFj6PgP8xuJ+E1BNSRWXDEoHuUCPBcs7X/ilwd0NibeBtPq+QHmNv KI2AM3QvPA+B66JqbLx8T1+BSDxMJJOm7M5KYETrvup/t/DtCoYrasouJ/E0a2nPpvTe sY+n9cEkKlY8GsYm9XNgm642PSb8xRdVgUwuoEynhzO1bF5UtINlkzFbWMIqgAKBHyvt LwbA== 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:references:in-reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=IfhPK1L6y3rw017RUONTn5kQQgIIO20S7PuQcjiORbE=; fh=6u41H9XDrxUGqeYNkyEJpkBL+/fUxHfysNGYq5DTPqY=; b=ewUkYpHdfKznE8NMgsWQeObI2tIAQAWXng18GUuKIe0vUT+wfSQXnWV9SvxHY4Yqrq t1W5bZvmudU6FsZeTDD0RQw4YHDS/2r4lWwA1EhhI+tWurre6/DzNCCWijwMUn5uDSI0 92IGJYwWeJDLqvZuRuXX68n2DVZ5GaS1KAXLSN1lZcLtSoQMUP+NihQid5waExHhs6xQ A83kBpPte7sexUtBXgIcE3pyc7wX9FybeZK8VqxWLd4f+AR4brEPUmG60pMky/g4dOiD s0J3hFtI8+HUTTCHyHOG/J9cMbfpa8UW9AyTlQkdKhKs5GiNxxZ9G5Pvt6q/RO0f3Xdq KqvA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=CZszdni2; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-191513-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-191513-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id a640c23a62f3a-a630d14313bsi104959966b.542.2024.05.27.16.43.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 May 2024 16:43:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-191513-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=CZszdni2; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-191513-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-191513-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=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 am.mirrors.kernel.org (Postfix) with ESMTPS id 481A01F2225E for ; Mon, 27 May 2024 23:43:01 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B2D161527BE; Mon, 27 May 2024 23:42:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="CZszdni2" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D255F17E8F8; Mon, 27 May 2024 23:42:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716853371; cv=none; b=fdmPb9mvJ9IBeLkjyqlQVmrcCY9reUzNDLmD442fl2aYPWyDm2Zly1x4UdjV+frRbjKawgeDkh4Q2CUKmP+u7qBdUcZz8HeL1EaPGxc2WV2s3nYEKUwWkwYM1WSmBVyqIPgkhNzAvuOlR/He0deVdw1M0eoYPuPGRlkxFS9+ixU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716853371; c=relaxed/simple; bh=XUGNe4Vne0m7pN3CMpt65nY5zW6n4Cua0wTpgEl0dxI=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=nQ+TtfVWVwypkQiZNTdIskpaJFn/Z6Iq0VC2H/dtflIx5ek3oDGNaXgCnjNtksrCsjO+cQUs5B2oVNQi3jC1Oqf4hQOZf5aywi6WeErp8U6qHjdajjqdcIP9nYhfOmH7BufXQu63kwSDMauEOEmrj1oQYi/whvs3/whCPCMJoAc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=CZszdni2; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id B19FAC2BBFC; Mon, 27 May 2024 23:42:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1716853371; bh=XUGNe4Vne0m7pN3CMpt65nY5zW6n4Cua0wTpgEl0dxI=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=CZszdni2CFdUNNsdaZQSdg5xyv2aQogk6pGHNwOc4uqLYLDCvOQmcSZ0kn8u+298X KpbX3qLNsRuXhWknHdCEkOhfPUtWjkSFsPv/EU9WtIAbyPTgRe8GoGqQGAY1AbHeOY hoXeHswPUOoGseVhJFFKmOC+BI2hk7/79aLxRobZfrbKEi4twNZOdHpv1gAu11jS90 zMPOTHWY7nd4og9A93W8OF0excwX1wAEgcksaNMyiyOH4tkk7veTAP6UflJz42ir9a jzw7zUJf2XnF1tK81SpynefzpwVwhNpFffDHLDKLMEIz9rLTl+jpUEMu8qwWUqE2nj eKslG/W+wlbcQ== Date: Mon, 27 May 2024 16:42:49 -0700 From: Jakub Kicinski To: Chen Ni Cc: nbd@nbd.name, sean.wang@mediatek.com, Mark-MC.Lee@mediatek.com, lorenzo@kernel.org, davem@davemloft.net, edumazet@google.com, pabeni@redhat.com, matthias.bgg@gmail.com, angelogioacchino.delregno@collabora.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: Re: [PATCH net-next v2] net: ethernet: mtk_eth_soc: add missing check for rhashtable_init Message-ID: <20240527164249.4aafd105@kernel.org> In-Reply-To: <20240517023922.362327-1-nichen@iscas.ac.cn> References: <20240517023922.362327-1-nichen@iscas.ac.cn> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Fri, 17 May 2024 10:39:22 +0800 Chen Ni wrote: > diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c > index cae46290a7ae..f9b8956a8726 100644 > --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c > +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c > @@ -4957,7 +4957,7 @@ static int mtk_probe(struct platform_device *pdev) > > eth->ppe[i] = mtk_ppe_init(eth, eth->base + ppe_addr, i); > > - if (!eth->ppe[i]) { > + if (IS_ERR_OR_NULL(eth->ppe[i])) { > err = -ENOMEM; You still discard the real error here. > goto err_deinit_ppe; > } > diff --git a/drivers/net/ethernet/mediatek/mtk_ppe.c b/drivers/net/ethernet/mediatek/mtk_ppe.c > index 0acee405a749..4895c6febaf8 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; Please convert the return NULL in this function to return ERR_PTR(-ENOMEM) and use the error code in mtk_probe() > - rhashtable_init(&ppe->l2_flows, &mtk_flow_l2_ht_params); > + ret = rhashtable_init(&ppe->l2_flows, &mtk_flow_l2_ht_params); > + if (ret) > + return ERR_PTR(ret); Also there are two direct return NULLs without calling rhashtable_destroy() later in this function. Please fix that in a separate patch. > /* need to allocate a separate device, since it PPE DMA access is > * not coherent.