[PATCH 2/2] staging: gdm72xx: NULL comparison style

From: Sudip Mukherjee
Date: Mon Sep 07 2015 - 08:38:51 EST


checkpatch complains if NULL comparison is done as if (var == NULL)

Signed-off-by: Sudip Mukherjee <sudip@xxxxxxxxxxxxxxx>
---
drivers/staging/gdm72xx/gdm_qos.c | 2 +-
drivers/staging/gdm72xx/gdm_sdio.c | 20 ++++++++++----------
drivers/staging/gdm72xx/gdm_usb.c | 16 ++++++++--------
drivers/staging/gdm72xx/gdm_wimax.c | 4 ++--
drivers/staging/gdm72xx/sdio_boot.c | 4 ++--
drivers/staging/gdm72xx/usb_boot.c | 4 ++--
6 files changed, 25 insertions(+), 25 deletions(-)

diff --git a/drivers/staging/gdm72xx/gdm_qos.c b/drivers/staging/gdm72xx/gdm_qos.c
index 96bf2bf..72c0f7ef 100644
--- a/drivers/staging/gdm72xx/gdm_qos.c
+++ b/drivers/staging/gdm72xx/gdm_qos.c
@@ -190,7 +190,7 @@ static int get_qos_index(struct nic *nic, u8 *iph, u8 *tcpudph)
int ip_ver, i;
struct qos_cb_s *qcb = &nic->qos;

- if (iph == NULL || tcpudph == NULL)
+ if (!iph || !tcpudph)
return -1;

ip_ver = (iph[0]>>4)&0xf;
diff --git a/drivers/staging/gdm72xx/gdm_sdio.c b/drivers/staging/gdm72xx/gdm_sdio.c
index a5fd079..b0521da 100644
--- a/drivers/staging/gdm72xx/gdm_sdio.c
+++ b/drivers/staging/gdm72xx/gdm_sdio.c
@@ -173,12 +173,12 @@ static int init_sdio(struct sdiowm_dev *sdev)
spin_lock_init(&tx->lock);

tx->sdu_buf = kmalloc(SDU_TX_BUF_SIZE, GFP_KERNEL);
- if (tx->sdu_buf == NULL)
+ if (!tx->sdu_buf)
goto fail;

for (i = 0; i < MAX_NR_SDU_BUF; i++) {
t = alloc_tx_struct(tx);
- if (t == NULL) {
+ if (!t) {
ret = -ENOMEM;
goto fail;
}
@@ -192,7 +192,7 @@ static int init_sdio(struct sdiowm_dev *sdev)

for (i = 0; i < MAX_NR_RX_BUF; i++) {
r = alloc_rx_struct(rx);
- if (r == NULL) {
+ if (!r) {
ret = -ENOMEM;
goto fail;
}
@@ -200,7 +200,7 @@ static int init_sdio(struct sdiowm_dev *sdev)
}

rx->rx_buf = kmalloc(RX_BUF_SIZE, GFP_KERNEL);
- if (rx->rx_buf == NULL)
+ if (!rx->rx_buf)
goto fail;

return 0;
@@ -359,7 +359,7 @@ static void do_tx(struct work_struct *work)
is_sdu = 1;
}

- if (!is_sdu && t == NULL) {
+ if (!is_sdu && !t) {
spin_unlock_irqrestore(&tx->lock, flags);
return;
}
@@ -393,7 +393,7 @@ static int gdm_sdio_send(void *priv_dev, void *data, int len,
cmd_evt = (pkt[0] << 8) | pkt[1];
if (cmd_evt == WIMAX_TX_SDU) {
t = get_tx_struct(tx, &no_spc);
- if (t == NULL) {
+ if (!t) {
/* This case must not happen. */
spin_unlock_irqrestore(&tx->lock, flags);
return -ENOSPC;
@@ -407,7 +407,7 @@ static int gdm_sdio_send(void *priv_dev, void *data, int len,
t->cb_data = cb_data;
} else {
t = alloc_tx_struct(tx);
- if (t == NULL) {
+ if (!t) {
spin_unlock_irqrestore(&tx->lock, flags);
return -ENOMEM;
}
@@ -581,7 +581,7 @@ static int gdm_sdio_receive(void *priv_dev,

spin_lock_irqsave(&rx->lock, flags);
r = get_rx_struct(rx);
- if (r == NULL) {
+ if (!r) {
spin_unlock_irqrestore(&rx->lock, flags);
return -ENOMEM;
}
@@ -615,12 +615,12 @@ static int sdio_wimax_probe(struct sdio_func *func,
return ret;

phy_dev = kzalloc(sizeof(*phy_dev), GFP_KERNEL);
- if (phy_dev == NULL) {
+ if (!phy_dev) {
ret = -ENOMEM;
goto out;
}
sdev = kzalloc(sizeof(*sdev), GFP_KERNEL);
- if (sdev == NULL) {
+ if (!sdev) {
ret = -ENOMEM;
goto out;
}
diff --git a/drivers/staging/gdm72xx/gdm_usb.c b/drivers/staging/gdm72xx/gdm_usb.c
index eac2f34..16e497d 100644
--- a/drivers/staging/gdm72xx/gdm_usb.c
+++ b/drivers/staging/gdm72xx/gdm_usb.c
@@ -139,7 +139,7 @@ static struct usb_rx *get_rx_struct(struct rx_cxt *rx)

if (list_empty(&rx->free_list)) {
r = alloc_rx_struct(rx);
- if (r == NULL)
+ if (!r)
return NULL;

list_add(&r->list, &rx->free_list);
@@ -224,7 +224,7 @@ static int init_usb(struct usbwm_dev *udev)
spin_lock_irqsave(&tx->lock, flags);
for (i = 0; i < MAX_NR_SDU_BUF; i++) {
t = alloc_tx_struct(tx);
- if (t == NULL) {
+ if (!t) {
spin_unlock_irqrestore(&tx->lock, flags);
ret = -ENOMEM;
goto fail;
@@ -234,7 +234,7 @@ static int init_usb(struct usbwm_dev *udev)
spin_unlock_irqrestore(&tx->lock, flags);

r = alloc_rx_struct(rx);
- if (r == NULL) {
+ if (!r) {
ret = -ENOMEM;
goto fail;
}
@@ -313,7 +313,7 @@ static int gdm_usb_send(void *priv_dev, void *data, int len,
cmd_evt = (pkt[0] << 8) | pkt[1];
if (cmd_evt == WIMAX_TX_SDU) {
t = get_tx_struct(tx, &no_spc);
- if (t == NULL) {
+ if (!t) {
/* This case must not happen. */
spin_unlock_irqrestore(&tx->lock, flags);
return -ENOSPC;
@@ -321,7 +321,7 @@ static int gdm_usb_send(void *priv_dev, void *data, int len,
list_add_tail(&t->list, &tx->sdu_list);
} else {
t = alloc_tx_struct(tx);
- if (t == NULL) {
+ if (!t) {
spin_unlock_irqrestore(&tx->lock, flags);
return -ENOMEM;
}
@@ -478,7 +478,7 @@ static int gdm_usb_receive(void *priv_dev,
r = get_rx_struct(rx);
spin_unlock_irqrestore(&rx->lock, flags);

- if (r == NULL)
+ if (!r)
return -ENOMEM;

r->callback = cb;
@@ -558,12 +558,12 @@ static int gdm_usb_probe(struct usb_interface *intf,
}

phy_dev = kzalloc(sizeof(*phy_dev), GFP_KERNEL);
- if (phy_dev == NULL) {
+ if (!phy_dev) {
ret = -ENOMEM;
goto out;
}
udev = kzalloc(sizeof(*udev), GFP_KERNEL);
- if (udev == NULL) {
+ if (!udev) {
ret = -ENOMEM;
goto out;
}
diff --git a/drivers/staging/gdm72xx/gdm_wimax.c b/drivers/staging/gdm72xx/gdm_wimax.c
index 08290d9..6e8dbaf 100644
--- a/drivers/staging/gdm72xx/gdm_wimax.c
+++ b/drivers/staging/gdm72xx/gdm_wimax.c
@@ -62,7 +62,7 @@ static inline int gdm_wimax_header(struct sk_buff **pskb)
struct sk_buff *skb2;

skb2 = skb_realloc_headroom(skb, HCI_HEADER_SIZE);
- if (skb2 == NULL)
+ if (!skb2)
return -ENOMEM;
if (skb->sk)
skb_set_owner_w(skb2, skb->sk);
@@ -397,7 +397,7 @@ static int gdm_wimax_ioctl_set_data(struct data_s *dst, struct data_s *src)
if (!(dst->buf && dst->size == src->size)) {
kdelete(&dst->buf);
dst->buf = kmalloc(src->size, GFP_KERNEL);
- if (dst->buf == NULL)
+ if (!dst->buf)
return -ENOMEM;
}

diff --git a/drivers/staging/gdm72xx/sdio_boot.c b/drivers/staging/gdm72xx/sdio_boot.c
index 2c02842..ba94b5f 100644
--- a/drivers/staging/gdm72xx/sdio_boot.c
+++ b/drivers/staging/gdm72xx/sdio_boot.c
@@ -72,7 +72,7 @@ static int download_image(struct sdio_func *func, const char *img_name)
}

buf = kmalloc(DOWNLOAD_SIZE + TYPE_A_HEADER_SIZE, GFP_KERNEL);
- if (buf == NULL)
+ if (!buf)
return -ENOMEM;

img_len = firm->size;
@@ -139,7 +139,7 @@ int sdio_boot(struct sdio_func *func)
const char *rfs_name = FW_DIR FW_RFS;

tx_buf = kmalloc(YMEM0_SIZE, GFP_KERNEL);
- if (tx_buf == NULL)
+ if (!tx_buf)
return -ENOMEM;

ret = download_image(func, krn_name);
diff --git a/drivers/staging/gdm72xx/usb_boot.c b/drivers/staging/gdm72xx/usb_boot.c
index 50fbec3..39ca34031 100644
--- a/drivers/staging/gdm72xx/usb_boot.c
+++ b/drivers/staging/gdm72xx/usb_boot.c
@@ -159,7 +159,7 @@ int usb_boot(struct usb_device *usbdev, u16 pid)
}

tx_buf = kmalloc(DOWNLOAD_SIZE, GFP_KERNEL);
- if (tx_buf == NULL) {
+ if (!tx_buf) {
release_firmware(firm);
return -ENOMEM;
}
@@ -287,7 +287,7 @@ static int em_download_image(struct usb_device *usbdev, const char *img_name,
}

buf = kmalloc(DOWNLOAD_CHUCK + pad_size, GFP_KERNEL);
- if (buf == NULL) {
+ if (!buf) {
release_firmware(firm);
return -ENOMEM;
}
--
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/