Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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.

Fixes: f362e5fe0f1f ("wan/hdlc_x25: make lapb params configurable")
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Xie He <xie.he.0141@gmail.com>
Acked-by: Martin Schiller <ms@dev.tdt.de>
Link: https://lore.kernel.org/r/20210203071541.86138-1-xie.he.0141@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Xie He and committed by
Jakub Kicinski
81b8be68 7b5eab57

+3 -3
+3 -3
drivers/net/wan/hdlc_x25.c
··· 169 169 170 170 result = lapb_register(dev, &cb); 171 171 if (result != LAPB_OK) 172 - return result; 172 + return -ENOMEM; 173 173 174 174 result = lapb_getparms(dev, &params); 175 175 if (result != LAPB_OK) 176 - return result; 176 + return -EINVAL; 177 177 178 178 if (state(hdlc)->settings.dce) 179 179 params.mode = params.mode | LAPB_DCE; ··· 188 188 189 189 result = lapb_setparms(dev, &params); 190 190 if (result != LAPB_OK) 191 - return result; 191 + return -EINVAL; 192 192 193 193 return 0; 194 194 }