[PATCH net-next v2 2/3] netconsole: pr_err() when netpoll_setup fails

From: Breno Leitao
Date: Mon Aug 19 2024 - 06:37:07 EST


netpoll_setup() can fail in several ways, some of which print an error
message, while others simply return without any message. For example,
__netpoll_setup() returns in a few places without printing anything.

To address this issue, modify the code to print an error message on
netconsole if the target is not enabled. This will help us identify and
troubleshoot netcnsole issues related to netpoll setup failures
more easily.

Signed-off-by: Breno Leitao <leitao@xxxxxxxxxx>
---
drivers/net/netconsole.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c
index 72384c1ecc5c..9b5f605fe87a 100644
--- a/drivers/net/netconsole.c
+++ b/drivers/net/netconsole.c
@@ -414,8 +414,10 @@ static ssize_t enabled_store(struct config_item *item,
netpoll_print_options(&nt->np);

ret = netpoll_setup(&nt->np);
- if (ret)
+ if (ret) {
+ pr_err("Not enabling netconsole. Netpoll setup failed\n");
goto out_unlock;
+ }

nt->enabled = true;
pr_info("network logging started\n");
--
2.43.5