diff options
author | Murali Karicheri <m-karicheri2@ti.com> | 2019-04-05 13:31:28 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2019-04-06 21:32:21 -0400 |
commit | 05ca6e644dc9b733379009137ba4cc7afce2256d (patch) | |
tree | 9132726d5a25f4dbf393027bb1d0b7882b981f6e /net/hsr/hsr_forward.c | |
parent | 0525fc069f03dfd871752eb7afc85075444c8b28 (diff) |
net: hsr: fix NULL checks in the code
This patch replaces all instance of NULL checks such as
if (foo == NULL) with if (!foo)
Also
if (foo != NULL) with if (foo)
This is seen when ran checkpatch.pl -f on files under net/hsr
and suggestion is to replace as above.
Signed-off-by: Murali Karicheri <m-karicheri2@ti.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/hsr/hsr_forward.c')
-rw-r--r-- | net/hsr/hsr_forward.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/net/hsr/hsr_forward.c b/net/hsr/hsr_forward.c index fdc191015208..68ca775d3be8 100644 --- a/net/hsr/hsr_forward.c +++ b/net/hsr/hsr_forward.c | |||
@@ -97,7 +97,7 @@ static struct sk_buff *create_stripped_skb(struct sk_buff *skb_in, | |||
97 | skb_pull(skb_in, HSR_HLEN); | 97 | skb_pull(skb_in, HSR_HLEN); |
98 | skb = __pskb_copy(skb_in, skb_headroom(skb_in) - HSR_HLEN, GFP_ATOMIC); | 98 | skb = __pskb_copy(skb_in, skb_headroom(skb_in) - HSR_HLEN, GFP_ATOMIC); |
99 | skb_push(skb_in, HSR_HLEN); | 99 | skb_push(skb_in, HSR_HLEN); |
100 | if (skb == NULL) | 100 | if (!skb) |
101 | return NULL; | 101 | return NULL; |
102 | 102 | ||
103 | skb_reset_mac_header(skb); | 103 | skb_reset_mac_header(skb); |
@@ -160,7 +160,7 @@ static struct sk_buff *create_tagged_skb(struct sk_buff *skb_o, | |||
160 | 160 | ||
161 | /* Create the new skb with enough headroom to fit the HSR tag */ | 161 | /* Create the new skb with enough headroom to fit the HSR tag */ |
162 | skb = __pskb_copy(skb_o, skb_headroom(skb_o) + HSR_HLEN, GFP_ATOMIC); | 162 | skb = __pskb_copy(skb_o, skb_headroom(skb_o) + HSR_HLEN, GFP_ATOMIC); |
163 | if (skb == NULL) | 163 | if (!skb) |
164 | return NULL; | 164 | return NULL; |
165 | skb_reset_mac_header(skb); | 165 | skb_reset_mac_header(skb); |
166 | 166 | ||
@@ -277,7 +277,7 @@ static void hsr_forward_do(struct hsr_frame_info *frame) | |||
277 | skb = frame_get_tagged_skb(frame, port); | 277 | skb = frame_get_tagged_skb(frame, port); |
278 | else | 278 | else |
279 | skb = frame_get_stripped_skb(frame, port); | 279 | skb = frame_get_stripped_skb(frame, port); |
280 | if (skb == NULL) { | 280 | if (!skb) { |
281 | /* FIXME: Record the dropped frame? */ | 281 | /* FIXME: Record the dropped frame? */ |
282 | continue; | 282 | continue; |
283 | } | 283 | } |
@@ -317,7 +317,7 @@ static int hsr_fill_frame_info(struct hsr_frame_info *frame, | |||
317 | 317 | ||
318 | frame->is_supervision = is_supervision_frame(port->hsr, skb); | 318 | frame->is_supervision = is_supervision_frame(port->hsr, skb); |
319 | frame->node_src = hsr_get_node(port, skb, frame->is_supervision); | 319 | frame->node_src = hsr_get_node(port, skb, frame->is_supervision); |
320 | if (frame->node_src == NULL) | 320 | if (!frame->node_src) |
321 | return -1; /* Unknown node and !is_supervision, or no mem */ | 321 | return -1; /* Unknown node and !is_supervision, or no mem */ |
322 | 322 | ||
323 | ethhdr = (struct ethhdr *) skb_mac_header(skb); | 323 | ethhdr = (struct ethhdr *) skb_mac_header(skb); |
@@ -364,9 +364,9 @@ void hsr_forward_skb(struct sk_buff *skb, struct hsr_port *port) | |||
364 | hsr_register_frame_in(frame.node_src, port, frame.sequence_nr); | 364 | hsr_register_frame_in(frame.node_src, port, frame.sequence_nr); |
365 | hsr_forward_do(&frame); | 365 | hsr_forward_do(&frame); |
366 | 366 | ||
367 | if (frame.skb_hsr != NULL) | 367 | if (frame.skb_hsr) |
368 | kfree_skb(frame.skb_hsr); | 368 | kfree_skb(frame.skb_hsr); |
369 | if (frame.skb_std != NULL) | 369 | if (frame.skb_std) |
370 | kfree_skb(frame.skb_std); | 370 | kfree_skb(frame.skb_std); |
371 | return; | 371 | return; |
372 | 372 | ||