Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp416536pxb; Thu, 12 Nov 2020 07:03:24 -0800 (PST) X-Google-Smtp-Source: ABdhPJzt5GAEPNFzGrvmUFKC2Evo7HpQ6wCBFnIIKaQjzoociXKTwTB5aRXiIvSFBDfOlpufq7zX X-Received: by 2002:a50:fe14:: with SMTP id f20mr122333edt.61.1605193403977; Thu, 12 Nov 2020 07:03:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605193403; cv=none; d=google.com; s=arc-20160816; b=Q46hOM12G6ew1ugJNRUD0qoy5+FiP7mpR8vkrjnyvtQr+EPA7hU9+7nJtmuhKSOilR +5NAoaW3zjCGY2DD+iCvhUIVspjFgaO4ETY3pgcnDqS5v8LpBVADfIsReTMov1XLQfd1 /WXQvuxsuAB5IRPIUFsmTMDqhZfMn9njinWy71Kx7Yy7cefdAWBFaK0ZTsB5JWhx5Olz VDt/7SYy5z/6kJImBPptmezjq99njNe0gOX1eM5Ywm7qGg5zx3oTOia4VZ2PgcKM8FNX FQTjUA/FnidOZ3IOZmBB0h03Dfpv/V0bHDUjMVc9lKXxyt3O4paVFArcy3e0AaeaDhYM OQzQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from; bh=/b/qsou3BbIHe8/ZI0tOYqRom2S1kHT7Q0L/GO8pFWE=; b=N230+VA+GlKLFK8C5eaOd+h+IxFaYSUamaxUPageLXUbYfccOYfniToqPU4Zr8oR0V v4SN4otHpmn3g8bl4fPZa82bAxXPPH8g5arhZoHBcvghQbKpmq4ObTjLtXHy2oW/U3kw i44q5as+D2BUp3LLayumdaXT6FuJiOofXgZkGfykLha63e4fqP5smYaQnxb0LDpDvqaA PPeG2RTPTWnD+eI4EsOw7ZyY8Jmp+1grgoUgZ2cRne/9GhxTNiMy5OGxWOuJrY0Rji23 481M49tYlBW9wU1ajbaFy0qSwBKgWK21dSAVoBoUuAoLBzaUX1m7Gf6mbh0t4QXxPUAg tlrw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bi20si4097314ejb.639.2020.11.12.07.02.56; Thu, 12 Nov 2020 07:03:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728578AbgKLO70 (ORCPT + 99 others); Thu, 12 Nov 2020 09:59:26 -0500 Received: from szxga05-in.huawei.com ([45.249.212.191]:7527 "EHLO szxga05-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727035AbgKLO70 (ORCPT ); Thu, 12 Nov 2020 09:59:26 -0500 Received: from DGGEMS407-HUB.china.huawei.com (unknown [172.30.72.60]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4CX4W22t36zhjsj; Thu, 12 Nov 2020 22:59:10 +0800 (CST) Received: from localhost (10.174.176.180) by DGGEMS407-HUB.china.huawei.com (10.3.19.207) with Microsoft SMTP Server id 14.3.487.0; Thu, 12 Nov 2020 22:59:10 +0800 From: YueHaibing To: , , , CC: , , Subject: [PATCH] nfp: Fix passing zero to 'PTR_ERR' Date: Thu, 12 Nov 2020 22:58:52 +0800 Message-ID: <20201112145852.6580-1-yuehaibing@huawei.com> X-Mailer: git-send-email 2.10.2.windows.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.174.176.180] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org nfp_cpp_from_nfp6000_pcie() returns ERR_PTR() and never returns NULL. The NULL test should be removed, also return correct err. Fixes: 63461a028f76 ("nfp: add the PF driver") Signed-off-by: YueHaibing --- drivers/net/ethernet/netronome/nfp/nfp_main.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/net/ethernet/netronome/nfp/nfp_main.c b/drivers/net/ethernet/netronome/nfp/nfp_main.c index 7ff2ccbd43b0..e672614d2906 100644 --- a/drivers/net/ethernet/netronome/nfp/nfp_main.c +++ b/drivers/net/ethernet/netronome/nfp/nfp_main.c @@ -724,10 +724,8 @@ static int nfp_pci_probe(struct pci_dev *pdev, } pf->cpp = nfp_cpp_from_nfp6000_pcie(pdev); - if (IS_ERR_OR_NULL(pf->cpp)) { + if (IS_ERR(pf->cpp)) { err = PTR_ERR(pf->cpp); - if (err >= 0) - err = -ENOMEM; goto err_disable_msix; } -- 2.17.1