Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 92619210 authored by Arnd Bergmann's avatar Arnd Bergmann Committed by David S. Miller
Browse files

qed: fix link config error handling



gcc-8 notices that qed_mcp_get_transceiver_data() may fail to
return a result to the caller:

drivers/net/ethernet/qlogic/qed/qed_mcp.c: In function 'qed_mcp_trans_speed_mask':
drivers/net/ethernet/qlogic/qed/qed_mcp.c:1955:2: error: 'transceiver_type' may be used uninitialized in this function [-Werror=maybe-uninitialized]

When an error is returned by qed_mcp_get_transceiver_data(), we
should propagate that to the caller of qed_mcp_trans_speed_mask()
rather than continuing with uninitialized data.

Fixes: c56a8be7 ("qed: Add supported link and advertise link to display in ethtool.")
Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent e8ccbb7d
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -1944,9 +1944,12 @@ int qed_mcp_trans_speed_mask(struct qed_hwfn *p_hwfn,
			     struct qed_ptt *p_ptt, u32 *p_speed_mask)
{
	u32 transceiver_type, transceiver_state;
	int ret;

	qed_mcp_get_transceiver_data(p_hwfn, p_ptt, &transceiver_state,
	ret = qed_mcp_get_transceiver_data(p_hwfn, p_ptt, &transceiver_state,
					   &transceiver_type);
	if (ret)
		return ret;

	if (qed_is_transceiver_ready(transceiver_state, transceiver_type) ==
				     false)