[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <d89c52a3-8f2b-e8a2-b15b-3b702913787c@seco.com>
Date: Tue, 25 Oct 2022 14:56:26 -0400
From: Sean Anderson <sean.anderson@...o.com>
To: Jakub Kicinski <kuba@...nel.org>, davem@...emloft.net
Cc: netdev@...r.kernel.org, edumazet@...gle.com, pabeni@...hat.com,
linux@...linux.org.uk, andrew@...n.ch, hkallweit1@...il.com,
rmk+kernel@...linux.org.uk
Subject: Re: [PATCH net-next] phylink: require valid state argument to
phylink_validate_mask_caps()
On 10/25/22 14:51, Jakub Kicinski wrote:
> state is deferenced earlier in the function, the NULL check
> is pointless. Since we don't have any crash reports presumably
> it's safe to assume state is not NULL.
Yes, I believe this was in place just for a patch which hasn't
been upstreamed.
> Fixes: f392a1846489 ("net: phylink: provide phylink_validate_mask_caps() helper")
> Signed-off-by: Jakub Kicinski <kuba@...nel.org>
> ---
> CC: linux@...linux.org.uk
> CC: andrew@...n.ch
> CC: hkallweit1@...il.com
> CC: sean.anderson@...o.com
> CC: rmk+kernel@...linux.org.uk
> ---
> drivers/net/phy/phylink.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c
> index 62106c9e9a9d..88f60e98b760 100644
> --- a/drivers/net/phy/phylink.c
> +++ b/drivers/net/phy/phylink.c
> @@ -564,7 +564,7 @@ EXPORT_SYMBOL_GPL(phylink_get_capabilities);
> /**
> * phylink_validate_mask_caps() - Restrict link modes based on caps
> * @supported: ethtool bitmask for supported link modes.
> - * @state: an (optional) pointer to a &struct phylink_link_state.
> + * @state: pointer to a &struct phylink_link_state.
> * @mac_capabilities: bitmask of MAC capabilities
> *
> * Calculate the supported link modes based on @mac_capabilities, and restrict
> @@ -585,8 +585,7 @@ void phylink_validate_mask_caps(unsigned long *supported,
> phylink_caps_to_linkmodes(mask, caps);
>
> linkmode_and(supported, supported, mask);
> - if (state)
> - linkmode_and(state->advertising, state->advertising, mask);
> + linkmode_and(state->advertising, state->advertising, mask);
> }
> EXPORT_SYMBOL_GPL(phylink_validate_mask_caps);
>
Reviewed-by: Sean Anderson <sean.anderson@...o.com>
Powered by blists - more mailing lists