From mboxrd@z Thu Jan 1 00:00:00 1970 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 6E4C7C433F5 for ; Tue, 30 Nov 2021 15:10:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236205AbhK3POM (ORCPT ); Tue, 30 Nov 2021 10:14:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60744 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243734AbhK3O61 (ORCPT ); Tue, 30 Nov 2021 09:58:27 -0500 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 29B11C0698D9; Tue, 30 Nov 2021 06:51:25 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 764E2CE1A4C; Tue, 30 Nov 2021 14:51:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E15DAC53FD1; Tue, 30 Nov 2021 14:51:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1638283881; bh=yx4FJX0G4UO5dBcgYjZHh3uXKkAvHKTCLfwikvuwZcs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Nb9zwmPkhiv9enesTv9c8ut1r8/ZqQ4UnbnuWH7RpnE4oAezJPb4aIChQBxSDZO0G fcJI8NVh9dr+1qXjbWxhSenOwqJVJd0+CFx5YPGz0LxDCL5csrVBjQ+1TwwAo2mhe9 sQYP58dmcqhoZh4isv5fiebpOZP376khea4a7P+0R5aNtXVJocGPzoSFx14UuxDb3Y FagTws1VxaK69nPLQL8coiSzHbYEzR2p9Q3ojhGv5bJ8cdZS+ZmKP9vugk6apiiX5b qgBfdCtvPD2RinW4xVDUpzOhSRb0iACYcjMZyL/JUwf7Ey+zwXk6P3nEWrdlrWmLtp utZROISY+ZnYw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Zheyu Ma , "David S . Miller" , Sasha Levin , rajur@chelsio.com, kuba@kernel.org, netdev@vger.kernel.org Subject: [PATCH AUTOSEL 5.10 25/43] net: chelsio: cxgb4vf: Fix an error code in cxgb4vf_pci_probe() Date: Tue, 30 Nov 2021 09:50:02 -0500 Message-Id: <20211130145022.945517-25-sashal@kernel.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211130145022.945517-1-sashal@kernel.org> References: <20211130145022.945517-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Zheyu Ma [ Upstream commit b82d71c0f84a2e5ccaaa7571dfd5c69e0e2cfb4a ] During the process of driver probing, probe function should return < 0 for failure, otherwise kernel will treat value == 0 as success. Therefore, we should set err to -EINVAL when adapter->registered_device_map is NULL. Otherwise kernel will assume that driver has been successfully probed and will cause unexpected errors. Signed-off-by: Zheyu Ma Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c b/drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c index 2820a0bb971bf..f43d522369859 100644 --- a/drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c +++ b/drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c @@ -3200,6 +3200,7 @@ static int cxgb4vf_pci_probe(struct pci_dev *pdev, } if (adapter->registered_device_map == 0) { dev_err(&pdev->dev, "could not register any net devices\n"); + err = -EINVAL; goto err_disable_interrupts; } -- 2.33.0