Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp911076pxp; Wed, 16 Mar 2022 21:02:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwdgdUkU9JSCTLAeZR3LvrToD2uQULoonmjHYfSLwNycENCOcdy8Ilra/1JI4k/+C9LA7SB X-Received: by 2002:a17:902:a3ca:b0:14f:d48e:aff3 with SMTP id q10-20020a170902a3ca00b0014fd48eaff3mr3005108plb.167.1647489729834; Wed, 16 Mar 2022 21:02:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647489729; cv=none; d=google.com; s=arc-20160816; b=cHkVhOm/h1n931zryreBT2lVhIJHulTsfB3cF3Az5NCQWvqXl1Q7aobmbIqn5ly8GG ZiSHEidIO35GdGn+e6Tz8l20TGgIOxnHZdbuCMib/SBhr00idFmlWXhKkmyU+GKEs53P JrDFWt7ISuLxqZzbJsKD6c2WfTb8Fw1iJE3A+U2kbPYnf/MGw3qNMM+rF9f71A+AJBsi YbXnt/yhtKi8lN8OgtszCTJQz6ow2mknMswGf1S/a8NIThCoetGpVrn+56se1BXdgW02 tZHUMDytXV4yLEBGtNPeQAPuQk2Isbg08CLnVoFWZZjfEuBmkLl/unSYnW+IWsft3iTd LAiw== 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=IDtyXxGx/+p65Qb3ZxZY2RZp0G/Z/g2UVklC6zDb/6A=; b=bPoYuBr/Soy+OQR64VdlF1sNo7v3biTMHTh4/QGe/cvgS7OKMkH76jF3f1hnnqdAE9 HagecZFrUQz9Tgr04EZxXWGfV/ReRxKe4CY6ZBa44LYrbga3yxUpMARZK6xkyNUQJnHW 953yr6G6yZdT52nJ0oEvJAOq1tKoUXad5K2YW5zjQ8APNSBYLs9D6ZT88Kgou+exoDdZ 3Vwqrm0RUY9iMOcCzLBw6XdR1JsLqP3nYM+QAkZUUNA9HuyO/NQabNhc2LxJYtFI3DY7 cUiN0T9ArT5gSBiIRVYxImz8QjtT/JNKsqjwU338NPKrbV6Z+O2EAsBmOpr29LwUIpKu zBlQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=AF7a9HBU; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id s1-20020a170902b18100b001517777d1dcsi3366960plr.216.2022.03.16.21.02.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Mar 2022 21:02:09 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=AF7a9HBU; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id ED5628C7F6; Wed, 16 Mar 2022 20:44:49 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235218AbiCNL7r (ORCPT + 99 others); Mon, 14 Mar 2022 07:59:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41476 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240150AbiCNL7V (ORCPT ); Mon, 14 Mar 2022 07:59:21 -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 407E960CE; Mon, 14 Mar 2022 04:57:47 -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 9FFBAB80DED; Mon, 14 Mar 2022 11:57:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BDA77C340EC; Mon, 14 Mar 2022 11:57:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1647259065; bh=eKf7exku32BFrG4wg8xA9kLRTfuahP7jg3a2aAF6vEo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AF7a9HBUGDVYNE4Fu4vETLZJnu+xpOKh7Ce0ZxAjQNGtE5l6EQ0EW7VsFmqMO3sBw nYMsTGjWz4bDyKhaH3P7vkxfqLkqncLjHfRF/cs9KkReTbuR2xVTn9UNeXq5j5IneN 2eiH3J5xi1DoOmdAs+CppYhI3PuBKZzT1sbGg6FQ= 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.4 05/43] qed: return status of qed_iov_get_link Date: Mon, 14 Mar 2022 12:53:16 +0100 Message-Id: <20220314112734.570383560@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220314112734.415677317@linuxfoundation.org> References: <20220314112734.415677317@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=-3.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 fb9c3ca5d36c..5e8f8eb916e6 100644 --- a/drivers/net/ethernet/qlogic/qed/qed_sriov.c +++ b/drivers/net/ethernet/qlogic/qed/qed_sriov.c @@ -3801,11 +3801,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, @@ -3813,7 +3813,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; @@ -3823,6 +3823,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 @@ -4684,6 +4685,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)) @@ -4697,7 +4699,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