[PATCH 03/11] net: ethernet: mtk_eth_soc: add support for Wireless Ethernet Dispatch (WED)

Jakub Kicinski kuba at kernel.org
Fri Feb 25 22:18:48 PST 2022


On Fri, 25 Feb 2022 11:18:02 +0100 Felix Fietkau wrote:
> +	page_list = kcalloc(n_pages, sizeof(*page_list), GFP_KERNEL);
> +	if (!page_list)
> +		return -ENOMEM;
> +
> +	dev->buf_ring.size = ring_size;
> +	dev->buf_ring.pages = page_list;
> +
> +	desc = dma_alloc_coherent(dev->hw->dev, ring_size * sizeof(*desc),
> +				  &desc_phys, GFP_KERNEL);
> +	if (!desc)
> +		return -ENOMEM;
> +
> +	dev->buf_ring.desc = desc;
> +	dev->buf_ring.desc_phys = desc_phys;
> +
> +	for (i = 0, page_idx = 0; i < ring_size; i += MTK_WED_BUF_PER_PAGE) {
> +		dma_addr_t page_phys, buf_phys;
> +		struct page *page;
> +		void *buf;
> +		int s;
> +
> +		page = __dev_alloc_pages(GFP_KERNEL, 0);
> +		if (!page)
> +			return -ENOMEM;

I haven't looked at the code, yet, but this sure looks leaky.



More information about the Linux-mediatek mailing list