[PATCH net-next V3 1/7] devlink: Skip health recover notifications before register

From: Mark Bloch

Date: Fri Jun 05 2026 - 14:12:05 EST


devlink health reports can be generated before the devlink instance is
registered. This can happen during driver initialization when a driver
creates health reporters early and its health polling detects an error
before devlink_register() is reached.

devlink health still records the report state and counters in that case,
but userspace cannot observe the devlink instance yet and there is no
registered handle to notify through. Skip the netlink notification while
the devlink instance is not registered instead of asserting registration.

This keeps later userspace queries useful after registration while avoiding
a warning from early health reports.

Signed-off-by: Mark Bloch <mbloch@xxxxxxxxxx>
---
net/devlink/health.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/net/devlink/health.c b/net/devlink/health.c
index ea7a334e939b..376e79497771 100644
--- a/net/devlink/health.c
+++ b/net/devlink/health.c
@@ -513,9 +513,8 @@ static void devlink_recover_notify(struct devlink_health_reporter *reporter,
int err;

WARN_ON(cmd != DEVLINK_CMD_HEALTH_REPORTER_RECOVER);
- ASSERT_DEVLINK_REGISTERED(devlink);

- if (!devlink_nl_notify_need(devlink))
+ if (!__devl_is_registered(devlink) || !devlink_nl_notify_need(devlink))
return;

msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL);
--
2.34.1