diff options
| author | Breno Leitao <[email protected]> | 2025-06-13 11:31:35 +0000 |
|---|---|---|
| committer | Jakub Kicinski <[email protected]> | 2025-06-16 22:18:34 +0000 |
| commit | d79206451f4f99a03907ab9390361ab83b607a6a (patch) | |
| tree | e16dc1fce9a4568a07649a43f7d66ba131d79fea /drivers/net/netconsole.c | |
| parent | netconsole: rename functions to better reflect their purpose (diff) | |
| download | kernel-d79206451f4f99a03907ab9390361ab83b607a6a.tar.gz kernel-d79206451f4f99a03907ab9390361ab83b607a6a.zip | |
netconsole: improve code style in parser function
Split assignment from conditional checks and use preferred null pointer
check style (!delim instead of == NULL) in netconsole_parser_cmdline().
This improves code readability and follows kernel coding style
conventions.
Signed-off-by: Breno Leitao <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Jakub Kicinski <[email protected]>
Diffstat (limited to 'drivers/net/netconsole.c')
| -rw-r--r-- | drivers/net/netconsole.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c index cc45ec18848c..89afe127b46c 100644 --- a/drivers/net/netconsole.c +++ b/drivers/net/netconsole.c @@ -1704,7 +1704,8 @@ static int netconsole_parser_cmdline(struct netpoll *np, char *opt) int ipv6; if (*cur != '@') { - if ((delim = strchr(cur, '@')) == NULL) + delim = strchr(cur, '@'); + if (!delim) goto parse_failed; *delim = 0; if (kstrtou16(cur, 10, &np->local_port)) @@ -1715,7 +1716,8 @@ static int netconsole_parser_cmdline(struct netpoll *np, char *opt) if (*cur != '/') { ipversion_set = true; - if ((delim = strchr(cur, '/')) == NULL) + delim = strchr(cur, '/'); + if (!delim) goto parse_failed; *delim = 0; ipv6 = netpoll_parse_ip_addr(cur, &np->local_ip); @@ -1729,7 +1731,8 @@ static int netconsole_parser_cmdline(struct netpoll *np, char *opt) if (*cur != ',') { /* parse out dev_name or dev_mac */ - if ((delim = strchr(cur, ',')) == NULL) + delim = strchr(cur, ','); + if (!delim) goto parse_failed; *delim = 0; @@ -1746,7 +1749,8 @@ static int netconsole_parser_cmdline(struct netpoll *np, char *opt) if (*cur != '@') { /* dst port */ - if ((delim = strchr(cur, '@')) == NULL) + delim = strchr(cur, '@'); + if (!delim) goto parse_failed; *delim = 0; if (*cur == ' ' || *cur == '\t') @@ -1758,7 +1762,8 @@ static int netconsole_parser_cmdline(struct netpoll *np, char *opt) cur++; /* dst ip */ - if ((delim = strchr(cur, '/')) == NULL) + delim = strchr(cur, '/'); + if (!delim) goto parse_failed; *delim = 0; ipv6 = netpoll_parse_ip_addr(cur, &np->remote_ip); |
