From: Saurav Girepunje <saurav.girepunje@gmail.com>
To: johannes@sipsolutions.net, kvalo@codeaurora.org,
davem@davemloft.net, kuba@kernel.org,
linux-wireless@vger.kernel.org, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
Cc: saurav.girepunje@hotmail.com
Subject: [PATCH] net: wireless: fix null check conditions in mac80211_hwsim.c
Date: Mon, 3 May 2021 13:03:45 +0530 [thread overview]
Message-ID: <20210503073345.GA37870@user> (raw)
Fixes checkpatch warning "Comparison to NULL could be written [...]".
CHECK: Comparison to NULL could be written "!skb"
+ if (skb == NULL)
CHECK: Comparison to NULL could be written "!skb"
+ if (skb == NULL)
CHECK: Comparison to NULL could be written "!skb"
+ if (skb == NULL)
CHECK: Comparison to NULL could be written "!msg_head"
+ if (msg_head == NULL) {
CHECK: Comparison to NULL could be written "!skb"
+ if (skb == NULL)
CHECK: Comparison to NULL could be written "!skb"
+ if (skb == NULL)
CHECK: Comparison to NULL could be written "!hwsim_mon"
+ if (hwsim_mon == NULL) {
Signed-off-by: Saurav Girepunje <saurav.girepunje@gmail.com>
---
drivers/net/wireless/mac80211_hwsim.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c
index 51ce767eaf88..05d010d5ed7b 100644
--- a/drivers/net/wireless/mac80211_hwsim.c
+++ b/drivers/net/wireless/mac80211_hwsim.c
@@ -1027,7 +1027,7 @@ static void mac80211_hwsim_monitor_rx(struct ieee80211_hw *hw,
return;
skb = skb_copy_expand(tx_skb, sizeof(*hdr), 0, GFP_ATOMIC);
- if (skb == NULL)
+ if (!skb)
return;
hdr = skb_push(skb, sizeof(*hdr));
@@ -1071,7 +1071,7 @@ static void mac80211_hwsim_monitor_ack(struct ieee80211_channel *chan,
return;
skb = dev_alloc_skb(100);
- if (skb == NULL)
+ if (!skb)
return;
hdr = skb_put(skb, sizeof(*hdr));
@@ -1282,12 +1282,12 @@ static void mac80211_hwsim_tx_frame_nl(struct ieee80211_hw *hw,
}
skb = genlmsg_new(GENLMSG_DEFAULT_SIZE, GFP_ATOMIC);
- if (skb == NULL)
+ if (!skb)
goto nla_put_failure;
msg_head = genlmsg_put(skb, 0, 0, &hwsim_genl_family, 0,
HWSIM_CMD_FRAME);
- if (msg_head == NULL) {
+ if (!msg_head) {
pr_debug("mac80211_hwsim: problem with msg_head\n");
goto nla_put_failure;
}
@@ -1797,7 +1797,7 @@ static void mac80211_hwsim_beacon_tx(void *arg, u8 *mac,
return;
skb = ieee80211_beacon_get(hw, vif);
- if (skb == NULL)
+ if (!skb)
return;
info = IEEE80211_SKB_CB(skb);
if (ieee80211_hw_check(hw, SUPPORTS_RC_TABLE))
@@ -3646,7 +3646,7 @@ static int hwsim_cloned_frame_received_nl(struct sk_buff *skb_2,
/* Allocate new skb here */
skb = alloc_skb(frame_data_len, GFP_KERNEL);
- if (skb == NULL)
+ if (!skb)
goto err;
if (frame_data_len > IEEE80211_MAX_DATA_LEN)
@@ -4550,7 +4550,7 @@ static int __init init_mac80211_hwsim(void)
hwsim_mon = alloc_netdev(0, "hwsim%d", NET_NAME_UNKNOWN,
hwsim_mon_setup);
- if (hwsim_mon == NULL) {
+ if (!hwsim_mon) {
err = -ENOMEM;
goto out_free_radios;
}
--
2.25.1
reply other threads:[~2021-05-03 7:33 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210503073345.GA37870@user \
--to=saurav.girepunje@gmail.com \
--cc=davem@davemloft.net \
--cc=johannes@sipsolutions.net \
--cc=kuba@kernel.org \
--cc=kvalo@codeaurora.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=saurav.girepunje@hotmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).