e3a1dda688ab5f34ccfc9f116c0f78a377a4b8fa
[openwrt/staging/ldir.git] /
1 From 2bf7e4a68c42eed909f3c29582e1fb85cb157e35 Mon Sep 17 00:00:00 2001
2 From: Jakub Kicinski <kuba@kernel.org>
3 Date: Tue, 25 Oct 2022 11:51:26 -0700
4 Subject: [PATCH 05/21] phylink: require valid state argument to
5 phylink_validate_mask_caps()
6
7 state is deferenced earlier in the function, the NULL check
8 is pointless. Since we don't have any crash reports presumably
9 it's safe to assume state is not NULL.
10
11 Fixes: f392a1846489 ("net: phylink: provide phylink_validate_mask_caps() helper")
12 Reviewed-by: Sean Anderson <sean.anderson@seco.com>
13 Link: https://lore.kernel.org/r/20221025185126.1720553-1-kuba@kernel.org
14 Signed-off-by: Jakub Kicinski <kuba@kernel.org>
15 ---
16 drivers/net/phy/phylink.c | 5 ++---
17 1 file changed, 2 insertions(+), 3 deletions(-)
18
19 --- a/drivers/net/phy/phylink.c
20 +++ b/drivers/net/phy/phylink.c
21 @@ -566,7 +566,7 @@ EXPORT_SYMBOL_GPL(phylink_get_capabiliti
22 /**
23 * phylink_validate_mask_caps() - Restrict link modes based on caps
24 * @supported: ethtool bitmask for supported link modes.
25 - * @state: an (optional) pointer to a &struct phylink_link_state.
26 + * @state: pointer to a &struct phylink_link_state.
27 * @mac_capabilities: bitmask of MAC capabilities
28 *
29 * Calculate the supported link modes based on @mac_capabilities, and restrict
30 @@ -587,8 +587,7 @@ void phylink_validate_mask_caps(unsigned
31 phylink_caps_to_linkmodes(mask, caps);
32
33 linkmode_and(supported, supported, mask);
34 - if (state)
35 - linkmode_and(state->advertising, state->advertising, mask);
36 + linkmode_and(state->advertising, state->advertising, mask);
37 }
38 EXPORT_SYMBOL_GPL(phylink_validate_mask_caps);
39