net: hdlc_x25: Return meaningful error code in x25_open
Subsystems (4)
PATCH 1/1 net: hdlc_x25: Return meaningful error code in x25_open
It's not meaningful to pass on LAPB error codes to HDLC code or other parts of the system, because they will not understand the error codes.
Instead, use system-wide recognizable error codes.
--- drivers/net/wan/hdlc_x25.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/wan/hdlc_x25.c +3 -3
@@ -169,11 +169,11 @@ static int x25_open(struct net_device *dev) result =lapb_register (dev, &cb);if (result !=LAPB_OK ) -return result; +return -ENOMEM ; result =lapb_getparms (dev, ¶ms);if (result !=LAPB_OK ) -return result; +return -EINVAL ;if (state (hdlc)->settings.dce) params.mode = params.mode |LAPB_DCE ;
@@ -188,7 +188,7 @@ static int x25_open(struct net_device *dev) result =lapb_setparms (dev, ¶ms);if (result !=LAPB_OK ) -return result; +return -EINVAL ;return 0 ; }
Signature · 1 line
2.27.0
Quoted 32 lines · Xie He
It's not meaningful to pass on LAPB error codes to HDLC code or other parts of the system, because they will not understand the error codes.
Instead, use system-wide recognizable error codes.
Fixes f362e5fe0f1f ("wan/hdlc_x25: make lapb params configurable")Fixes 1da177e4c3f4 ("Linux-2.6.12-rc2")Cc Martin Schiller <[email protected]>Signed-off-by Xie He <[email protected]>--- drivers/net/wan/hdlc_x25.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/net/wan/hdlc_x25.c +2
-2@@ -169,11 +169,11 @@ static int x25_open(struct net_device *dev) result =lapb_register (dev, &cb);if (result !=LAPB_OK ) -return result; +return -ENOMEM ; result =lapb_getparms (dev, ¶ms);if (result !=LAPB_OK ) -return result; +return -EINVAL ;if (state (hdlc)->settings.dce) params.mode = params.mode |LAPB_DCE ;
drivers/net/wan/hdlc_x25.c static int x25_open(struct net_device *dev) · line 194
Quoted 8 lines
drivers/net/wan/hdlc_x25.c +1
-1@@ -188,7 +188,7 @@ static int x25_open(struct net_device *dev) result =lapb_setparms (dev, ¶ms);if (result !=LAPB_OK ) -return result; +return -EINVAL ;return 0 ; }
Thanks for fixing this.
This patch was applied to netdev/net.git (refs/heads/master):
Hello:
This patch was applied to netdev/net.git (refs/heads/master):
Quoted 11 lines · On Tue, 2 Feb 2021 23:15:41 -0800 you wrote:
It's not meaningful to pass on LAPB error codes to HDLC code or other parts of the system, because they will not understand the error codes.
Instead, use system-wide recognizable error codes.
Fixes f362e5fe0f1f ("wan/hdlc_x25: make lapb params configurable")Fixes 1da177e4c3f4 ("Linux-2.6.12-rc2")Cc Martin Schiller <[email protected]>Signed-off-by Xie He <[email protected]>[...]
Here is the summary with links:
- [net] net: hdlc_x25: Return meaningful error code in x25_open
https://git.kernel.org/netdev/net/c/81b8be68ef8e
You are awesome, thank you!