Commit 5d0e7dde authored by Dmitry Antipov's avatar Dmitry Antipov Committed by Felix Fietkau

wifi: mt76: add DMA mapping error check in mt76_alloc_txwi()

Add 'dma_mapping_error()' check in 'mt76_alloc_txwi()'.
Signed-off-by: default avatarDmitry Antipov <dmantipov@yandex.ru>
Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
parent 832f4269
......@@ -53,6 +53,11 @@ mt76_alloc_txwi(struct mt76_dev *dev)
addr = dma_map_single(dev->dma_dev, txwi, dev->drv->txwi_size,
DMA_TO_DEVICE);
if (unlikely(dma_mapping_error(dev->dma_dev, addr))) {
kfree(txwi);
return NULL;
}
t = (struct mt76_txwi_cache *)(txwi + dev->drv->txwi_size);
t->dma_addr = addr;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment