pd692x0_req_managers_pw_budget() uses each manager regulator's supply
without a NULL check. The supply is NULL while the vmain regulator is
described but not registered yet, because regulator_register() does not
wait for its supply. Probe then crashes.
Return -EPROBE_DEFER in that case. On net, each retry also leaks the
notification kfifo and the PI array until vmain appears; the fix for
that is in the PSE core fixes for net-next.
Fixes: 359754013e6a ("net: pse-pd: pd692x0: Add support for PSE PI priority feature")
Signed-off-by: Carlo Szelinsky <redacted>
---
drivers/net/pse-pd/pd692x0.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/drivers/net/pse-pd/pd692x0.c b/drivers/net/pse-pd/pd692x0.c
index 34f0dfbccd06..568789bd912f 100644
--- a/drivers/net/pse-pd/pd692x0.c
+++ b/drivers/net/pse-pd/pd692x0.c
@@ -1056,6 +1056,15 @@ pd692x0_req_managers_pw_budget(struct pd692x0_priv *priv)
struct regulator *supply = priv->manager_reg[i]->supply;
int pw_budget;
+ /* The regulator core registers the manager regulator even
+ * when its vmain supply cannot be resolved yet and retries
+ * later, leaving ->supply NULL until then.
+ */
+ if (!supply)
+ return dev_err_probe(&priv->client->dev, -EPROBE_DEFER,
+ "manager %d: vmain supply not resolved\n",
+ i);
+
pw_budget = regulator_get_unclaimed_power_budget(supply);
if (!pw_budget)
/* Do nothing if no power budget */
--
2.43.0