Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp234689pxp; Wed, 16 Mar 2022 04:51:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxFzImBwOOndAVgbqlV4KrPKdfXMoQMGk70WQGXt9jhde54RMSRlwiyGvYEmQWpcjoIeViD X-Received: by 2002:a17:902:bf07:b0:14f:a3a7:97a0 with SMTP id bi7-20020a170902bf0700b0014fa3a797a0mr32940832plb.105.1647431483095; Wed, 16 Mar 2022 04:51:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647431483; cv=none; d=google.com; s=arc-20160816; b=fyRKYbVe1lILW5TqbsopFvAjXoGKps7Po5yIEROxc9MiMiTcjlC+eg/+5OV/bBN2HS GXvmb4EC6yHwEjkCAfc0UT+k/zoblsMgq1ZVcF6LM5Qjnb66gcCs2hcT9/utFF0a+RNr B2GZCT8v2YJYyRqjry4yahoFuWRKo7NGBHKfJhZGI1to+fOSBJk3kdQXrNk1NPwy0wX+ SDIdgvKy5swsrXabBhbE7CAEzA5bSpYBs22kVH7fXB1/gz/vhhR3C/Azu9PsnUXDFDjO L9lQW+tN/EUiY77J6cSns3EQe6LuIG4xR2q/3C/X6lqTGlUSPq9vPvsAssaASt8yNdtO sA7A== 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=qh7zeQuUJrlwju9WjvmyCSzzTE3/kFmRmQT5wj/XhVw=; b=nDZdTH8F9hPw5qJG0k8TKry+uCTU8rsLbIzlpG73Hm8wahPSI1SDMBeUIgAwZBr+NV 6P9tui44mtEFZMu6WxDeKynb7SmB/Zrbt2AAdVEvzgcUZFiVUGseFy1D4Puh3bLbzhd6 crNYO5nbmxsR5SlQaDrj6ztHC0SHHbGD4PbMOle9EtXpRWZ6e8x+WIj2rFhJb3ZGDJUG JmY8qd24HHS8in5aeyDp0KuO0uPVCHh2CI0UowTA40h7B88gNyuGHzAaFoU4OzwwyqNW BWJgvdzyiF0jLB6bUNVz+vBzCP34hioccXVGOUW7g9pTQLKBr+NfMc+vr33HkIljIJ+Z 23gw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=yOXEb62J; 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 bj7-20020a056a02018700b00378bbeba906si1802520pgb.191.2022.03.16.04.51.11; Wed, 16 Mar 2022 04:51:23 -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=yOXEb62J; 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 S240857AbiCNMNk (ORCPT + 99 others); Mon, 14 Mar 2022 08:13:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59550 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241402AbiCNMIl (ORCPT ); Mon, 14 Mar 2022 08:08:41 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AF5B14D617; Mon, 14 Mar 2022 05:05:08 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 3450C61333; Mon, 14 Mar 2022 12:05:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9EE97C340E9; Mon, 14 Mar 2022 12:05:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1647259507; bh=phEX2o4kGjcEwrUXdZwA2/tdOklVcHKaImRgkEMmqPw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yOXEb62JPovkAmxlDkwDGmzOKuplRHDVH8qHVdx5sv63imAqnT0q7U/S+aJft+tiR 34DuZ3m0ft8CzWzrBjtdY5gVwBEhTQy+y07PC8zN8UiQ5e0FgYKoWNpHSVr6me1CIz av66Jj4DjR4ahI4xqcadOKDcnFpWjQuAPNEO3SFQ= 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 5.15 022/110] qed: return status of qed_iov_get_link Date: Mon, 14 Mar 2022 12:53:24 +0100 Message-Id: <20220314112743.655806943@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220314112743.029192918@linuxfoundation.org> References: <20220314112743.029192918@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 ed2b6fe5a78d..998378ce9983 100644 --- a/drivers/net/ethernet/qlogic/qed/qed_sriov.c +++ b/drivers/net/ethernet/qlogic/qed/qed_sriov.c @@ -3778,11 +3778,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, @@ -3790,7 +3790,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; @@ -3800,6 +3800,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 @@ -4658,6 +4659,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)) @@ -4671,7 +4673,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