From mboxrd@z Thu Jan 1 00:00:00 1970 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 F1D032566 for ; Tue, 18 Apr 2023 12:27:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 76084C433EF; Tue, 18 Apr 2023 12:27:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1681820859; bh=vP1CQ7n3A8UAdIcv9Up82ehRod7FV+KfCTpUhDT3sPc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LfgPwfOUMF81loojaXeurjpU1sg0SQEwE5g2eGbleSLsEjeiqV4jDfXLoFDqrbc37 axe8M2BMqxzmio79/QNqHYvetuaf2w2ebnIl2v6gI7cLauVk3xRjb+AE8NiOBMn0RQ ZXdXs3ZeMiKEQs5xLF9eghoCozbZvT9VDXz1R/0E= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Denis Plotnikov , Simon Horman , Bjorn Helgaas , "David S. Miller" , Sasha Levin Subject: [PATCH 4.19 38/57] qlcnic: check pci_reset_function result Date: Tue, 18 Apr 2023 14:21:38 +0200 Message-Id: <20230418120300.068711923@linuxfoundation.org> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230418120258.713853188@linuxfoundation.org> References: <20230418120258.713853188@linuxfoundation.org> User-Agent: quilt/0.67 Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Denis Plotnikov [ Upstream commit 7573099e10ca69c3be33995c1fcd0d241226816d ] Static code analyzer complains to unchecked return value. The result of pci_reset_function() is unchecked. Despite, the issue is on the FLR supported code path and in that case reset can be done with pcie_flr(), the patch uses less invasive approach by adding the result check of pci_reset_function(). Found by Linux Verification Center (linuxtesting.org) with SVACE. Fixes: 7e2cf4feba05 ("qlcnic: change driver hardware interface mechanism") Signed-off-by: Denis Plotnikov Reviewed-by: Simon Horman Reviewed-by: Bjorn Helgaas Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c index d344e9d438321..d3030bd967d5a 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c @@ -629,7 +629,13 @@ int qlcnic_fw_create_ctx(struct qlcnic_adapter *dev) int i, err, ring; if (dev->flags & QLCNIC_NEED_FLR) { - pci_reset_function(dev->pdev); + err = pci_reset_function(dev->pdev); + if (err) { + dev_err(&dev->pdev->dev, + "Adapter reset failed (%d). Please reboot\n", + err); + return err; + } dev->flags &= ~QLCNIC_NEED_FLR; } -- 2.39.2