[PATCH 1/4] atm: idt77252: Adjust four function calls together with a variable assignment

From: SF Markus Elfring
Date: Sat Aug 05 2017 - 08:27:02 EST


From: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 4 Aug 2017 22:20:08 +0200

The script "checkpatch.pl" pointed information out like the following.

ERROR: do not use assignment in if condition

Thus fix the affected source code places.

Signed-off-by: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx>
---
drivers/atm/idt77252.c | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/drivers/atm/idt77252.c b/drivers/atm/idt77252.c
index b7a168c46692..6a051f5909d0 100644
--- a/drivers/atm/idt77252.c
+++ b/drivers/atm/idt77252.c
@@ -1070,7 +1070,8 @@ dequeue_rx(struct idt77252_dev *card, struct rsq_entry *rsqe)

cell = skb->data;
for (i = (stat & SAR_RSQE_CELLCNT); i; i--) {
- if ((sb = dev_alloc_skb(64)) == NULL) {
+ sb = dev_alloc_skb(64);
+ if (!sb) {
printk("%s: Can't allocate buffers for aal0.\n",
card->name);
atomic_add(i, &vcc->stats->rx_drop);
@@ -1304,7 +1305,8 @@ idt77252_rx_raw(struct idt77252_dev *card)
goto drop;
}

- if ((sb = dev_alloc_skb(64)) == NULL) {
+ sb = dev_alloc_skb(64);
+ if (!sb) {
printk("%s: Can't allocate buffers for AAL0.\n",
card->name);
atomic_inc(&vcc->stats->rx_err);
@@ -3600,13 +3602,14 @@ static int idt77252_init_one(struct pci_dev *pcidev,
struct atm_dev *dev;
int i, err;

-
- if ((err = pci_enable_device(pcidev))) {
+ err = pci_enable_device(pcidev);
+ if (err) {
printk("idt77252: can't enable PCI device at %s\n", pci_name(pcidev));
return err;
}

- if ((err = dma_set_mask_and_coherent(&pcidev->dev, DMA_BIT_MASK(32)))) {
+ err = dma_set_mask_and_coherent(&pcidev->dev, DMA_BIT_MASK(32));
+ if (err) {
printk("idt77252: can't enable DMA for PCI device at %s\n", pci_name(pcidev));
return err;
}
--
2.13.4