mirror of
https://github.com/outbackdingo/mt76.git
synced 2026-10-24 13:26:48 +00:00
treewide: Replace more open-coded allocation size multiplications
As done treewide earlier, this catches several more open-coded allocation size calculations that were added to the kernel during the merge window. This performs the following mechanical transformations using Coccinelle: kvmalloc(a * b, ...) -> kvmalloc_array(a, b, ...) kvzalloc(a * b, ...) -> kvcalloc(a, b, ...) devm_kzalloc(..., a * b, ...) -> devm_kcalloc(..., a, b, ...) Signed-off-by: Kees Cook <[email protected]>
This commit is contained in:
@@ -318,7 +318,7 @@ int mt76u_buf_alloc(struct mt76_dev *dev, struct mt76u_buf *buf,
|
||||
if (!buf->urb)
|
||||
return -ENOMEM;
|
||||
|
||||
buf->urb->sg = devm_kzalloc(dev->dev, nsgs * sizeof(*buf->urb->sg),
|
||||
buf->urb->sg = devm_kcalloc(dev->dev, nsgs, sizeof(*buf->urb->sg),
|
||||
gfp);
|
||||
if (!buf->urb->sg)
|
||||
return -ENOMEM;
|
||||
@@ -525,8 +525,8 @@ static int mt76u_alloc_rx(struct mt76_dev *dev)
|
||||
|
||||
spin_lock_init(&q->rx_page_lock);
|
||||
spin_lock_init(&q->lock);
|
||||
q->entry = devm_kzalloc(dev->dev,
|
||||
MT_NUM_RX_ENTRIES * sizeof(*q->entry),
|
||||
q->entry = devm_kcalloc(dev->dev,
|
||||
MT_NUM_RX_ENTRIES, sizeof(*q->entry),
|
||||
GFP_KERNEL);
|
||||
if (!q->entry)
|
||||
return -ENOMEM;
|
||||
@@ -755,8 +755,8 @@ static int mt76u_alloc_tx(struct mt76_dev *dev)
|
||||
INIT_LIST_HEAD(&q->swq);
|
||||
q->hw_idx = mt76_ac_to_hwq(i);
|
||||
|
||||
q->entry = devm_kzalloc(dev->dev,
|
||||
MT_NUM_TX_ENTRIES * sizeof(*q->entry),
|
||||
q->entry = devm_kcalloc(dev->dev,
|
||||
MT_NUM_TX_ENTRIES, sizeof(*q->entry),
|
||||
GFP_KERNEL);
|
||||
if (!q->entry)
|
||||
return -ENOMEM;
|
||||
|
||||
Reference in New Issue
Block a user