linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] mt76: usb: reduce code indentation in mt76u_alloc_tx
       [not found] <cover.1551703530.git.lorenzo@kernel.org>
@ 2019-03-04 12:59 ` Lorenzo Bianconi
  2019-03-16 19:30   ` Felix Fietkau
  0 siblings, 1 reply; 2+ messages in thread
From: Lorenzo Bianconi @ 2019-03-04 12:59 UTC (permalink / raw)
  To: nbd; +Cc: linux-wireless, joe, lorenzo.bianconi

Improve code readability reducing code indentation in
mt76u_alloc_tx

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
---
Changes since v1:
- use devm_kcalloc instead of devm_kzalloc and get rid of size
---
 drivers/net/wireless/mediatek/mt76/usb.c | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/drivers/net/wireless/mediatek/mt76/usb.c b/drivers/net/wireless/mediatek/mt76/usb.c
index 4c1abd492405..508931101178 100644
--- a/drivers/net/wireless/mediatek/mt76/usb.c
+++ b/drivers/net/wireless/mediatek/mt76/usb.c
@@ -810,15 +810,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;
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] mt76: usb: reduce code indentation in mt76u_alloc_tx
  2019-03-04 12:59 ` [PATCH v2] mt76: usb: reduce code indentation in mt76u_alloc_tx Lorenzo Bianconi
@ 2019-03-16 19:30   ` Felix Fietkau
  0 siblings, 0 replies; 2+ messages in thread
From: Felix Fietkau @ 2019-03-16 19:30 UTC (permalink / raw)
  To: Lorenzo Bianconi; +Cc: linux-wireless, joe, lorenzo.bianconi

On 2019-03-04 13:59, Lorenzo Bianconi wrote:
> Improve code readability reducing code indentation in
> mt76u_alloc_tx
> 
> Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Applied, thanks.

- Felix

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-03-16 19:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <cover.1551703530.git.lorenzo@kernel.org>
2019-03-04 12:59 ` [PATCH v2] mt76: usb: reduce code indentation in mt76u_alloc_tx Lorenzo Bianconi
2019-03-16 19:30   ` Felix Fietkau

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