Skip to content

Commit 4e64b1e

Browse files
JoePerchesdavem330
authored andcommitted
net/ipv6: Convert icmpv6_push_pending_frames to void
commit cc71b7b ("net/ipv6: remove unused err variable on icmpv6_push_pending_frames") exposed icmpv6_push_pending_frames return value not being used. Remove now unnecessary int err declarations and uses. Miscellanea: o Remove unnecessary goto and out: labels o Realign arguments Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent cc71b7b commit 4e64b1e

File tree

3 files changed

+22
-30
lines changed

3 files changed

+22
-30
lines changed

include/net/ipv6.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -300,8 +300,8 @@ static inline void fl6_sock_release(struct ip6_flowlabel *fl)
300300

301301
void icmpv6_notify(struct sk_buff *skb, u8 type, u8 code, __be32 info);
302302

303-
int icmpv6_push_pending_frames(struct sock *sk, struct flowi6 *fl6,
304-
struct icmp6hdr *thdr, int len);
303+
void icmpv6_push_pending_frames(struct sock *sk, struct flowi6 *fl6,
304+
struct icmp6hdr *thdr, int len);
305305

306306
int ip6_ra_control(struct sock *sk, int sel);
307307

net/ipv6/icmp.c

Lines changed: 18 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -250,15 +250,15 @@ static bool opt_unrec(struct sk_buff *skb, __u32 offset)
250250
return (*op & 0xC0) == 0x80;
251251
}
252252

253-
int icmpv6_push_pending_frames(struct sock *sk, struct flowi6 *fl6,
254-
struct icmp6hdr *thdr, int len)
253+
void icmpv6_push_pending_frames(struct sock *sk, struct flowi6 *fl6,
254+
struct icmp6hdr *thdr, int len)
255255
{
256256
struct sk_buff *skb;
257257
struct icmp6hdr *icmp6h;
258258

259259
skb = skb_peek(&sk->sk_write_queue);
260260
if (!skb)
261-
goto out;
261+
return;
262262

263263
icmp6h = icmp6_hdr(skb);
264264
memcpy(icmp6h, thdr, sizeof(struct icmp6hdr));
@@ -286,8 +286,6 @@ int icmpv6_push_pending_frames(struct sock *sk, struct flowi6 *fl6,
286286
tmp_csum);
287287
}
288288
ip6_push_pending_frames(sk);
289-
out:
290-
return 0;
291289
}
292290

293291
struct icmpv6_msg {
@@ -437,7 +435,6 @@ static void icmp6_send(struct sk_buff *skb, u8 type, u8 code, __u32 info,
437435
int iif = 0;
438436
int addr_type = 0;
439437
int len;
440-
int err = 0;
441438
u32 mark = IP6_REPLY_MARK(net, skb->mark);
442439

443440
if ((u8 *)hdr < skb->head ||
@@ -574,17 +571,16 @@ static void icmp6_send(struct sk_buff *skb, u8 type, u8 code, __u32 info,
574571
rcu_read_lock();
575572
idev = __in6_dev_get(skb->dev);
576573

577-
err = ip6_append_data(sk, icmpv6_getfrag, &msg,
578-
len + sizeof(struct icmp6hdr),
579-
sizeof(struct icmp6hdr),
580-
&ipc6, &fl6, (struct rt6_info *)dst,
581-
MSG_DONTWAIT, &sockc_unused);
582-
if (err) {
574+
if (ip6_append_data(sk, icmpv6_getfrag, &msg,
575+
len + sizeof(struct icmp6hdr),
576+
sizeof(struct icmp6hdr),
577+
&ipc6, &fl6, (struct rt6_info *)dst,
578+
MSG_DONTWAIT, &sockc_unused)) {
583579
ICMP6_INC_STATS(net, idev, ICMP6_MIB_OUTERRORS);
584580
ip6_flush_pending_frames(sk);
585581
} else {
586-
err = icmpv6_push_pending_frames(sk, &fl6, &tmp_hdr,
587-
len + sizeof(struct icmp6hdr));
582+
icmpv6_push_pending_frames(sk, &fl6, &tmp_hdr,
583+
len + sizeof(struct icmp6hdr));
588584
}
589585
rcu_read_unlock();
590586
out_dst_release:
@@ -681,7 +677,6 @@ static void icmpv6_echo_reply(struct sk_buff *skb)
681677
struct icmpv6_msg msg;
682678
struct dst_entry *dst;
683679
struct ipcm6_cookie ipc6;
684-
int err = 0;
685680
u32 mark = IP6_REPLY_MARK(net, skb->mark);
686681
struct sockcm_cookie sockc_unused = {0};
687682

@@ -718,8 +713,7 @@ static void icmpv6_echo_reply(struct sk_buff *skb)
718713
else if (!fl6.flowi6_oif)
719714
fl6.flowi6_oif = np->ucast_oif;
720715

721-
err = ip6_dst_lookup(net, sk, &dst, &fl6);
722-
if (err)
716+
if (ip6_dst_lookup(net, sk, &dst, &fl6))
723717
goto out;
724718
dst = xfrm_lookup(net, dst, flowi6_to_flowi(&fl6), sk, 0);
725719
if (IS_ERR(dst))
@@ -736,17 +730,16 @@ static void icmpv6_echo_reply(struct sk_buff *skb)
736730
ipc6.dontfrag = np->dontfrag;
737731
ipc6.opt = NULL;
738732

739-
err = ip6_append_data(sk, icmpv6_getfrag, &msg, skb->len + sizeof(struct icmp6hdr),
740-
sizeof(struct icmp6hdr), &ipc6, &fl6,
741-
(struct rt6_info *)dst, MSG_DONTWAIT,
742-
&sockc_unused);
743-
744-
if (err) {
733+
if (ip6_append_data(sk, icmpv6_getfrag, &msg,
734+
skb->len + sizeof(struct icmp6hdr),
735+
sizeof(struct icmp6hdr), &ipc6, &fl6,
736+
(struct rt6_info *)dst, MSG_DONTWAIT,
737+
&sockc_unused)) {
745738
__ICMP6_INC_STATS(net, idev, ICMP6_MIB_OUTERRORS);
746739
ip6_flush_pending_frames(sk);
747740
} else {
748-
err = icmpv6_push_pending_frames(sk, &fl6, &tmp_hdr,
749-
skb->len + sizeof(struct icmp6hdr));
741+
icmpv6_push_pending_frames(sk, &fl6, &tmp_hdr,
742+
skb->len + sizeof(struct icmp6hdr));
750743
}
751744
dst_release(dst);
752745
out:

net/ipv6/ping.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,9 +154,8 @@ static int ping_v6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
154154
ICMP6_MIB_OUTERRORS);
155155
ip6_flush_pending_frames(sk);
156156
} else {
157-
err = icmpv6_push_pending_frames(sk, &fl6,
158-
(struct icmp6hdr *) &pfh.icmph,
159-
len);
157+
icmpv6_push_pending_frames(sk, &fl6,
158+
(struct icmp6hdr *)&pfh.icmph, len);
160159
}
161160
release_sock(sk);
162161

0 commit comments

Comments
 (0)