From patchwork Wed May 12 14:44:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 438021 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7AF82C4361A for ; Wed, 12 May 2021 16:42:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4600861177 for ; Wed, 12 May 2021 16:42:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243068AbhELQkQ (ORCPT ); Wed, 12 May 2021 12:40:16 -0400 Received: from mail.kernel.org ([198.145.29.99]:50408 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234863AbhELQcI (ORCPT ); Wed, 12 May 2021 12:32:08 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id A780C61C26; Wed, 12 May 2021 15:58:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620835105; bh=dXf5vGQwieSUUgoo/DezY1gSGpeymCL14N2PqbDveSA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WYo5/EvbZMfOcyZE9X3/sjQ+BW6pLRLRkQbmZHtZGeS5prfMJ391nVpNNuXo1zi2i Z6O2pLOUFKT+M1bTMdifwKkInJhj1pgQn1lj5c5nHm8fzG3dDt9NU0z98Mv1Dodvdo ONMag1lfaVIlIUcGC3bO/1ZxEGFVYS/HaEaoz6G8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Sasha Levin Subject: [PATCH 5.12 210/677] staging: qlge: fix an error code in probe() Date: Wed, 12 May 2021 16:44:16 +0200 Message-Id: <20210512144844.220920807@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210512144837.204217980@linuxfoundation.org> References: <20210512144837.204217980@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Dan Carpenter [ Upstream commit f7bff017741d98567265ed6a6449311a51810fb6 ] If alloc_etherdev_mq() fails then return -ENOMEM instead of success. The "err = 0;" triggers an unused assignment now so remove that as well. Fixes: 953b94009377 ("staging: qlge: Initialize devlink health dump framework") Signed-off-by: Dan Carpenter Link: https://lore.kernel.org/r/YFiyicHI189PXrha@mwanda Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/staging/qlge/qlge_main.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/staging/qlge/qlge_main.c b/drivers/staging/qlge/qlge_main.c index 5516be3af898..c1d52190e1bd 100644 --- a/drivers/staging/qlge/qlge_main.c +++ b/drivers/staging/qlge/qlge_main.c @@ -4550,7 +4550,7 @@ static int qlge_probe(struct pci_dev *pdev, struct net_device *ndev = NULL; struct devlink *devlink; static int cards_found; - int err = 0; + int err; devlink = devlink_alloc(&qlge_devlink_ops, sizeof(struct qlge_adapter)); if (!devlink) @@ -4561,8 +4561,10 @@ static int qlge_probe(struct pci_dev *pdev, ndev = alloc_etherdev_mq(sizeof(struct qlge_netdev_priv), min(MAX_CPUS, netif_get_num_default_rss_queues())); - if (!ndev) + if (!ndev) { + err = -ENOMEM; goto devlink_free; + } ndev_priv = netdev_priv(ndev); ndev_priv->qdev = qdev;