net: ethernet: mtk_eth_soc: fix NULL pointer dereference
authorDaniel Golle <daniel@makrotopia.org>
Tue, 9 May 2023 01:20:06 +0000 (03:20 +0200)
committerDavid S. Miller <davem@davemloft.net>
Wed, 10 May 2023 08:23:53 +0000 (09:23 +0100)
commit7c83e28f10830aa5105c25eaabe890e3adac36aa
tree0c3674baae71025515eed358e484f99da984b489
parent582dbb2cc1a0a7427840f5b1e3c65608e511b061
net: ethernet: mtk_eth_soc: fix NULL pointer dereference

Check for NULL pointer to avoid kernel crashing in case of missing WO
firmware in case only a single WEDv2 device has been initialized, e.g. on
MT7981 which can connect just one wireless frontend.

Fixes: 86ce0d09e424 ("net: ethernet: mtk_eth_soc: use WO firmware for MT7981")
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Reviewed-by: Simon Horman <simon.horman@corigine.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mediatek/mtk_wed.c