[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <bb29d6d8-6887-4eed-ba24-7392de9c2c29@linux.alibaba.com>
Date: Mon, 10 Mar 2025 09:42:07 +0800
From: Shuai Xue <xueshuai@...ux.alibaba.com>
To: Markus Elfring <Markus.Elfring@....de>, dmaengine@...r.kernel.org,
Dave Jiang <dave.jiang@...el.com>, Fenghua Yu <fenghuay@...dia.com>,
Vinicius Costa Gomes <vinicius.gomes@...el.com>,
Vinod Koul <vkoul@...nel.org>
Cc: LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v3 1/9] dmaengine: idxd: fix memory leak in error handling
path of idxd_setup_wqs()
在 2025/3/9 17:10, Markus Elfring 写道:
> …
>> +++ b/drivers/dma/idxd/init.c
> …
>> @@ -203,7 +201,6 @@ static int idxd_setup_wqs(struct idxd_device *idxd)
>> wq->enqcmds_retries = IDXD_ENQCMDS_RETRIES;
>> wq->wqcfg = kzalloc_node(idxd->wqcfg_size, GFP_KERNEL, dev_to_node(dev));
>> if (!wq->wqcfg) {
>> - put_device(conf_dev);
>> rc = -ENOMEM;
>> goto err;
>> }
>
> I suggest to move such an error code assignment also to the end of this function implementation.
>
I prefer to set error code before jumping to error handling label
so that we can extend/change the error code in any future path.
> Regards,
> Markus
Thanks for valuable comments.
Best Regards,
Shuai
Powered by blists - more mailing lists