generic: mt7530: fix null pointer dereferencing in port5 setup
[oweals/openwrt.git] / target / linux / generic / backport-5.4 / 739-v5.5-net-phylink-update-to-use-phy_support_asym_pause.patch
1 From 09d7d8395ec61fba4392b35baa6f71c4e36489df Mon Sep 17 00:00:00 2001
2 From: Russell King <rmk+kernel@armlinux.org.uk>
3 Date: Fri, 8 Nov 2019 15:18:02 +0000
4 Subject: [PATCH 637/660] net: phylink: update to use phy_support_asym_pause()
5
6 Use phy_support_asym_pause() rather than open-coding it.
7
8 Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
9 ---
10  drivers/net/phy/phylink.c | 17 +++++++----------
11  1 file changed, 7 insertions(+), 10 deletions(-)
12
13 --- a/drivers/net/phy/phylink.c
14 +++ b/drivers/net/phy/phylink.c
15 @@ -718,11 +718,6 @@ static int phylink_bringup_phy(struct ph
16         __ETHTOOL_DECLARE_LINK_MODE_MASK(supported);
17         int ret;
18  
19 -       memset(&config, 0, sizeof(config));
20 -       linkmode_copy(supported, phy->supported);
21 -       linkmode_copy(config.advertising, phy->advertising);
22 -       config.interface = pl->link_config.interface;
23 -
24         /*
25          * This is the new way of dealing with flow control for PHYs,
26          * as described by Timur Tabi in commit 529ed1275263 ("net: phy:
27 @@ -730,10 +725,12 @@ static int phylink_bringup_phy(struct ph
28          * using our validate call to the MAC, we rely upon the MAC
29          * clearing the bits from both supported and advertising fields.
30          */
31 -       if (phylink_test(supported, Pause))
32 -               phylink_set(config.advertising, Pause);
33 -       if (phylink_test(supported, Asym_Pause))
34 -               phylink_set(config.advertising, Asym_Pause);
35 +       phy_support_asym_pause(phy);
36 +
37 +       memset(&config, 0, sizeof(config));
38 +       linkmode_copy(supported, phy->supported);
39 +       linkmode_copy(config.advertising, phy->advertising);
40 +       config.interface = pl->link_config.interface;
41  
42         ret = phylink_validate(pl, supported, &config);
43         if (ret)