lkml.org 
[lkml]   [2022]   [Jan]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH AUTOSEL 5.16 108/217] net: dsa: ocelot: felix: Remove requirement for PCS in felix devices
    Date
    From: Colin Foster <colin.foster@in-advantage.com>

    [ Upstream commit 49af6a7620c53b779572abfbfd7778e113154330 ]

    Existing felix devices all have an initialized pcs array. Future devices
    might not, so running a NULL check on the array before dereferencing it
    will allow those future drivers to not crash at this point

    Signed-off-by: Colin Foster <colin.foster@in-advantage.com>
    Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
    Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    ---
    drivers/net/dsa/ocelot/felix.c | 2 +-
    1 file changed, 1 insertion(+), 1 deletion(-)

    diff --git a/drivers/net/dsa/ocelot/felix.c b/drivers/net/dsa/ocelot/felix.c
    index f1a05e7dc8181..221440a61e17e 100644
    --- a/drivers/net/dsa/ocelot/felix.c
    +++ b/drivers/net/dsa/ocelot/felix.c
    @@ -823,7 +823,7 @@ static void felix_phylink_mac_config(struct dsa_switch *ds, int port,
    struct felix *felix = ocelot_to_felix(ocelot);
    struct dsa_port *dp = dsa_to_port(ds, port);

    - if (felix->pcs[port])
    + if (felix->pcs && felix->pcs[port])
    phylink_set_pcs(dp->pl, &felix->pcs[port]->pcs);
    }

    --
    2.34.1
    \
     
     \ /
      Last update: 2022-01-18 03:34    [W:2.500 / U:0.196 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site