Skip to content

Commit 856dd3d

Browse files
jukkarjhedberg
authored andcommitted
net: ppp: ipcp: Remove dead code
If nack_idx > 0, then the count_rej must be > 0. This means that the "code" variable will never be set to PPP_CONFIGURE_NACK. Fixes #22436 Coverity-CID: 207975 Signed-off-by: Jukka Rissanen <[email protected]>
1 parent 8c95536 commit 856dd3d

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

subsys/net/l2/ppp/ipcp.c

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ static int ipcp_config_info_req(struct ppp_fsm *fsm,
8585
u16_t length,
8686
struct net_buf **ret_buf)
8787
{
88-
int nack_idx = 0, count_rej = 0, address_option_idx = -1;
88+
int nack_idx = 0, address_option_idx = -1;
8989
struct net_buf *buf = NULL;
9090
struct ppp_option_pkt options[MAX_IPCP_OPTIONS];
9191
struct ppp_option_pkt nack_options[MAX_IPCP_OPTIONS];
@@ -120,7 +120,6 @@ static int ipcp_config_info_req(struct ppp_fsm *fsm,
120120
break;
121121

122122
default:
123-
count_rej++;
124123
nack_options[nack_idx].type.ipcp =
125124
options[i].type.ipcp;
126125
nack_options[nack_idx].len = options[i].len;
@@ -139,11 +138,7 @@ static int ipcp_config_info_req(struct ppp_fsm *fsm,
139138
if (nack_idx > 0) {
140139
struct net_buf *nack_buf;
141140

142-
if (count_rej > 0) {
143-
code = PPP_CONFIGURE_REJ;
144-
} else {
145-
code = PPP_CONFIGURE_NACK;
146-
}
141+
code = PPP_CONFIGURE_REJ;
147142

148143
/* Create net_buf containing options that are not accepted */
149144
for (i = 0; i < MIN(nack_idx, ARRAY_SIZE(nack_options)); i++) {

0 commit comments

Comments
 (0)