linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: wireless: fix null check conditions in mac80211_hwsim.c
@ 2021-05-03  7:33 Saurav Girepunje
  0 siblings, 0 replies; only message in thread
From: Saurav Girepunje @ 2021-05-03  7:33 UTC (permalink / raw)
  To: johannes, kvalo, davem, kuba, linux-wireless, netdev, linux-kernel
  Cc: saurav.girepunje

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


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2021-05-03  7:33 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-03  7:33 [PATCH] net: wireless: fix null check conditions in mac80211_hwsim.c Saurav Girepunje

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).