qed: return status of qed_iov_get_link
[ 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: 73390ac9d8
("qed*: support ndo_get_vf_config")
Signed-off-by: Tom Rix <trix@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:

committed by
Greg Kroah-Hartman

parent
5bee2ed050
commit
93223495bc
@@ -3778,11 +3778,11 @@ bool qed_iov_mark_vf_flr(struct qed_hwfn *p_hwfn, u32 *p_disabled_vfs)
|
|||||||
return found;
|
return found;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void qed_iov_get_link(struct qed_hwfn *p_hwfn,
|
static int qed_iov_get_link(struct qed_hwfn *p_hwfn,
|
||||||
u16 vfid,
|
u16 vfid,
|
||||||
struct qed_mcp_link_params *p_params,
|
struct qed_mcp_link_params *p_params,
|
||||||
struct qed_mcp_link_state *p_link,
|
struct qed_mcp_link_state *p_link,
|
||||||
struct qed_mcp_link_capabilities *p_caps)
|
struct qed_mcp_link_capabilities *p_caps)
|
||||||
{
|
{
|
||||||
struct qed_vf_info *p_vf = qed_iov_get_vf_info(p_hwfn,
|
struct qed_vf_info *p_vf = qed_iov_get_vf_info(p_hwfn,
|
||||||
vfid,
|
vfid,
|
||||||
@@ -3790,7 +3790,7 @@ static void qed_iov_get_link(struct qed_hwfn *p_hwfn,
|
|||||||
struct qed_bulletin_content *p_bulletin;
|
struct qed_bulletin_content *p_bulletin;
|
||||||
|
|
||||||
if (!p_vf)
|
if (!p_vf)
|
||||||
return;
|
return -EINVAL;
|
||||||
|
|
||||||
p_bulletin = p_vf->bulletin.p_virt;
|
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);
|
__qed_vf_get_link_state(p_hwfn, p_link, p_bulletin);
|
||||||
if (p_caps)
|
if (p_caps)
|
||||||
__qed_vf_get_link_caps(p_hwfn, p_caps, p_bulletin);
|
__qed_vf_get_link_caps(p_hwfn, p_caps, p_bulletin);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
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_public_vf_info *vf_info;
|
||||||
struct qed_mcp_link_state link;
|
struct qed_mcp_link_state link;
|
||||||
u32 tx_rate;
|
u32 tx_rate;
|
||||||
|
int ret;
|
||||||
|
|
||||||
/* Sanitize request */
|
/* Sanitize request */
|
||||||
if (IS_VF(cdev))
|
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);
|
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 */
|
/* Fill information about VF */
|
||||||
ivi->vf = vf_id;
|
ivi->vf = vf_id;
|
||||||
|
Reference in New Issue
Block a user