On 10/16/25 1:06 PM, Xuan Zhuo wrote:
+int eea_adminq_destroy_q(struct eea_net *enet, u32 qidx, int num)
+{
+ struct device *dev = enet->edev->dma_dev;
+ dma_addr_t dma_addr;
+ __le16 *buf;
+ int i, err;
+ u32 size;
+
+ if (qidx == 0 && num == -1)
+ return eea_adminq_exec(enet, EEA_AQ_CMD_QUEUE_DESTROY_ALL,
+ NULL, 0, NULL, 0);
+
+ size = sizeof(__le16) * num;
+ buf = dma_alloc_coherent(dev, size, &dma_addr, GFP_KERNEL);
+ if (!buf)
+ return -ENOMEM;
AFAICS all the callers of this function use num == -1 argument, why is
this other case needed? I guess it could land in a follow-up actually
using it.
Requiring memory allocation to perform cleanup operation is dangerous:
it may fail under memory pressure, making the memory pressure even worse.
You could instead pre-allocate the buffer at initialization time.
Otherwise LGTM,
Thanks,
Paolo