mt76: usb: reduce code indentation in mt76u_alloc_tx
authorLorenzo Bianconi <lorenzo@kernel.org>
Mon, 4 Mar 2019 12:59:49 +0000 (13:59 +0100)
committerFelix Fietkau <nbd@nbd.name>
Wed, 1 May 2019 11:03:56 +0000 (13:03 +0200)
Improve code readability reducing code indentation in
mt76u_alloc_tx

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
drivers/net/wireless/mediatek/mt76/usb.c

index 65b0c244307f441d3aa70c510ba5e2730a366e9f..27896a435d6c4846ac78c53675e04ce3cc8bec5f 100644 (file)
@@ -818,15 +818,14 @@ static int mt76u_alloc_tx(struct mt76_dev *dev)
                        if (!buf->urb)
                                return -ENOMEM;
 
-                       if (dev->usb.sg_en) {
-                               size_t size = MT_SG_MAX_SIZE *
-                                             sizeof(struct scatterlist);
-
-                               buf->urb->sg = devm_kzalloc(dev->dev, size,
-                                                           GFP_KERNEL);
-                               if (!buf->urb->sg)
-                                       return -ENOMEM;
-                       }
+                       if (!dev->usb.sg_en)
+                               continue;
+
+                       buf->urb->sg = devm_kcalloc(dev->dev, MT_SG_MAX_SIZE,
+                                                   sizeof(struct scatterlist),
+                                                   GFP_KERNEL);
+                       if (!buf->urb->sg)
+                               return -ENOMEM;
                }
        }
        return 0;