1 From 057bcf15db8e625276ddf02b2b7c668a3cb43f81 Mon Sep 17 00:00:00 2001
2 From: Christian Marangi <ansuelsmth@gmail.com>
3 Date: Sun, 4 Sep 2022 23:46:24 +0200
4 Subject: [net PATCH] net: dsa: qca8k: fix NULL pointer dereference for
5 of_device_get_match_data
7 of_device_get_match_data is called on priv->dev before priv->dev is
8 actually set. Move of_device_get_match_data after priv->dev is correctly
9 set to fix this kernel panic.
11 Fixes: 3bb0844e7bcd ("net: dsa: qca8k: cache match data to speed up access")
12 Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
14 drivers/net/dsa/qca/qca8k-8xxx.c | 2 +-
15 1 file changed, 1 insertion(+), 1 deletion(-)
17 --- a/drivers/net/dsa/qca/qca8k-8xxx.c
18 +++ b/drivers/net/dsa/qca/qca8k-8xxx.c
19 @@ -1835,9 +1835,9 @@ qca8k_sw_probe(struct mdio_device *mdiod
23 - priv->info = of_device_get_match_data(priv->dev);
24 priv->bus = mdiodev->bus;
25 priv->dev = &mdiodev->dev;
26 + priv->info = of_device_get_match_data(priv->dev);
28 priv->reset_gpio = devm_gpiod_get_optional(priv->dev, "reset",