Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp3183944pxp; Mon, 14 Mar 2022 12:46:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyCSg5yPSMr9ivPkTHzghFMLhVEbQh0/gpiMnAV634054p35LYYidSKPzTIZtuRKImKYkT1 X-Received: by 2002:a05:6402:3492:b0:416:cbed:4f39 with SMTP id v18-20020a056402349200b00416cbed4f39mr16757363edc.87.1647287202150; Mon, 14 Mar 2022 12:46:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647287202; cv=none; d=google.com; s=arc-20160816; b=Qd11EyOkzRDt0fS3ZFlgWHA+2IRvWoOcRwGY8o+be8zW6kFCqAGSAn0hYgVh0qlX7Z 7XiJlNugFFnIk+Ixajyg0YPGOfl/8/c+eG8Qj9bM+5KGccCMGbW8JPxUBVwW4PO+8Izy ivTQ5S/8l4i/52JTxAhfbLmtOnM+3kWia2vM6pERw7Jwkl4gGTj9mOrs2rqvHxlDEcVq eUWPpJtpTnAvI8uHuEPqQ/Jaa7zY0YljvCb/Gtv44hHsJBzhqF6b9hgqv+5/kV3sQsZK Luwt+R918UpYPPO+eTbCXHE0rZhBWOeZh+/qytWKmjFfPpINiSm9sHg8oib32ev3NsIY Y66w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=nc2xNstw7EAivNKD/JdVxPuczM0AN2kB5HYAHrPMqjY=; b=cgcp4XNBPzlVoltSCRtDx9W4taTu6quTFbfkFattMPSIkbPXcPLRB8789fnq46Ln6e Cf3bgq5wH8dKrxlrEsVcMRF60rFUJdiGKNJF/3POlUPncsFXLT6SXn2eukwDjfQySox1 8vt2vlK7lTpCoQAAIY6TQCYG/iPn8YWk6fP904jYCVDWq+xp/SoVhiT3Z0KOkDrbcGkp D2+y9dmbZi/2GYqVEU6sbBkqFAGs8dAbjJRdjWOTVm34eS8JB32r+2Ui27+vdglxrL8n AWDoFCqRAa18RYLS9N7eINTYCOG1pDecQCKebtzTJwgnUqK7iYbTRNX/d867n3JgAM6J CQGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=MKp+R4BO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y22-20020a056402441600b0041895b04d6esi1518811eda.275.2022.03.14.12.46.16; Mon, 14 Mar 2022 12:46:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=MKp+R4BO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239260AbiCNLlW (ORCPT + 99 others); Mon, 14 Mar 2022 07:41:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40654 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239493AbiCNLk5 (ORCPT ); Mon, 14 Mar 2022 07:40:57 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 06E6548E66; Mon, 14 Mar 2022 04:38:43 -0700 (PDT) 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 ams.source.kernel.org (Postfix) with ESMTPS id DD42DB80DC1; Mon, 14 Mar 2022 11:38:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 157A9C340E9; Mon, 14 Mar 2022 11:38:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1647257919; bh=ANw4WhF00SQmtkyNTw6/Lwg9Zxg/E7XyWecEsdm4nVk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MKp+R4BOL6N4+Yhe540cmd+hfiApNGKz1hfwr3W2um55HKUQrSzY697JeH8q2rLkx Bj4J2nd1OeLA9fuJKXvJfKSGgV8/Zk8AHy7/4fhNjeiPL2b3TMeYJJ2/6wvVpuI3Za 5rxgiAN6tuhtdzPh0RGZMPFYtkOpOclYNoFrEMUo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tom Rix , "David S. Miller" , Sasha Levin Subject: [PATCH 4.19 02/30] qed: return status of qed_iov_get_link Date: Mon, 14 Mar 2022 12:34:20 +0100 Message-Id: <20220314112731.857338067@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220314112731.785042288@linuxfoundation.org> References: <20220314112731.785042288@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-8.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Tom Rix [ Upstream commit d9dc0c84ad2d4cc911ba252c973d1bf18d5eb9cf ] Clang static analysis reports this issue qed_sriov.c:4727:19: warning: Assigned value is garbage or undefined ivi->max_tx_rate = tx_rate ? tx_rate : link.speed; ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ link is only sometimes set by the call to qed_iov_get_link() qed_iov_get_link fails without setting link or returning status. So change the decl to return status. Fixes: 73390ac9d82b ("qed*: support ndo_get_vf_config") Signed-off-by: Tom Rix Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/qlogic/qed/qed_sriov.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/drivers/net/ethernet/qlogic/qed/qed_sriov.c b/drivers/net/ethernet/qlogic/qed/qed_sriov.c index 886c7aae662f..285231bc318b 100644 --- a/drivers/net/ethernet/qlogic/qed/qed_sriov.c +++ b/drivers/net/ethernet/qlogic/qed/qed_sriov.c @@ -3800,11 +3800,11 @@ bool qed_iov_mark_vf_flr(struct qed_hwfn *p_hwfn, u32 *p_disabled_vfs) return found; } -static void qed_iov_get_link(struct qed_hwfn *p_hwfn, - u16 vfid, - struct qed_mcp_link_params *p_params, - struct qed_mcp_link_state *p_link, - struct qed_mcp_link_capabilities *p_caps) +static int qed_iov_get_link(struct qed_hwfn *p_hwfn, + u16 vfid, + struct qed_mcp_link_params *p_params, + struct qed_mcp_link_state *p_link, + struct qed_mcp_link_capabilities *p_caps) { struct qed_vf_info *p_vf = qed_iov_get_vf_info(p_hwfn, vfid, @@ -3812,7 +3812,7 @@ static void qed_iov_get_link(struct qed_hwfn *p_hwfn, struct qed_bulletin_content *p_bulletin; if (!p_vf) - return; + return -EINVAL; p_bulletin = p_vf->bulletin.p_virt; @@ -3822,6 +3822,7 @@ static void qed_iov_get_link(struct qed_hwfn *p_hwfn, __qed_vf_get_link_state(p_hwfn, p_link, p_bulletin); if (p_caps) __qed_vf_get_link_caps(p_hwfn, p_caps, p_bulletin); + return 0; } static int @@ -4676,6 +4677,7 @@ static int qed_get_vf_config(struct qed_dev *cdev, struct qed_public_vf_info *vf_info; struct qed_mcp_link_state link; u32 tx_rate; + int ret; /* Sanitize request */ if (IS_VF(cdev)) @@ -4689,7 +4691,9 @@ static int qed_get_vf_config(struct qed_dev *cdev, vf_info = qed_iov_get_public_vf_info(hwfn, vf_id, true); - qed_iov_get_link(hwfn, vf_id, NULL, &link, NULL); + ret = qed_iov_get_link(hwfn, vf_id, NULL, &link, NULL); + if (ret) + return ret; /* Fill information about VF */ ivi->vf = vf_id; -- 2.34.1