* [PATCH] net: ynl: return actual error code in ynl_exec_dump()
@ 2025-09-26 9:58 Haofeng Li
2025-09-26 18:24 ` Jakub Kicinski
0 siblings, 1 reply; 3+ messages in thread
From: Haofeng Li @ 2025-09-26 9:58 UTC (permalink / raw)
To: Donald Hunter, Jakub Kicinski
Cc: netdev, linux-kernel, Haofeng Li, Haofeng Li
From: Haofeng Li <lihaofeng@kylinos.cn>
Return the real error code 'err' instead of hardcoded -1 in the error
path of ynl_exec_dump(). This provides better error information to
callers for debugging and error handling.
Signed-off-by: Haofeng Li <lihaofeng@kylinos.cn>
---
tools/net/ynl/lib/ynl.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/net/ynl/lib/ynl.c b/tools/net/ynl/lib/ynl.c
index 2a169c3c0797..1a79adcc3ac0 100644
--- a/tools/net/ynl/lib/ynl.c
+++ b/tools/net/ynl/lib/ynl.c
@@ -1064,5 +1064,5 @@ int ynl_exec_dump(struct ynl_sock *ys, struct nlmsghdr *req_nlh,
err_close_list:
yds->first = ynl_dump_end(yds);
- return -1;
+ return err;
}
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] net: ynl: return actual error code in ynl_exec_dump()
2025-09-26 9:58 [PATCH] net: ynl: return actual error code in ynl_exec_dump() Haofeng Li
@ 2025-09-26 18:24 ` Jakub Kicinski
2025-09-30 12:39 ` [PATCH WITHDRAWN] " Haofeng Li
0 siblings, 1 reply; 3+ messages in thread
From: Jakub Kicinski @ 2025-09-26 18:24 UTC (permalink / raw)
To: Haofeng Li; +Cc: Donald Hunter, netdev, linux-kernel, Haofeng Li, Haofeng Li
On Fri, 26 Sep 2025 17:58:20 +0800 Haofeng Li wrote:
> Return the real error code 'err' instead of hardcoded -1 in the error
> path of ynl_exec_dump(). This provides better error information to
> callers for debugging and error handling.
Do you have a realistic example that can happen today? This is not
kernel code the error is always -1, and the details are in errno.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH WITHDRAWN] net: ynl: return actual error code in ynl_exec_dump()
2025-09-26 18:24 ` Jakub Kicinski
@ 2025-09-30 12:39 ` Haofeng Li
0 siblings, 0 replies; 3+ messages in thread
From: Haofeng Li @ 2025-09-30 12:39 UTC (permalink / raw)
To: kuba; +Cc: 13266079573, 920484857, donald.hunter, lihaofeng, linux-kernel,
netdev
> This is not kernel code the error is always -1, and the details are in errno.
Thank you for the feedback and for pointing that out.
You are absolutely right. I now understand that in the context of this
userspace code, the error handling convention relies on errno for
details when the return value is -1. My patch was attempting to align
the return value with a specific internal error code, which, as you clarified,
is not the established practice here and doesn't provide the intended
benefit in this case.
I appreciate you taking the time to explain this.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-09-30 12:39 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-26 9:58 [PATCH] net: ynl: return actual error code in ynl_exec_dump() Haofeng Li
2025-09-26 18:24 ` Jakub Kicinski
2025-09-30 12:39 ` [PATCH WITHDRAWN] " Haofeng Li
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).