From: Dinh Nguyen <dinguyen@kernel.org>
To: Yang Yingliang <yangyingliang@huawei.com>,
linux-kernel@vger.kernel.org, richard.gong@intel.com,
atull@kernel.org, tien.sung.ang@intel.com
Subject: Re: [PATCH 1/2] firmware: stratix10-svc: add missing gen_pool_destroy() in stratix10_svc_drv_probe()
Date: Mon, 7 Nov 2022 13:56:39 -0600 [thread overview]
Message-ID: <83accdc8-2a6f-fa7c-ed82-a7cafc3eda39@kernel.org> (raw)
In-Reply-To: <20221103070951.1496435-2-yangyingliang@huawei.com>
On 11/3/22 02:09, Yang Yingliang wrote:
> In error path in stratix10_svc_drv_probe(), gen_pool_destroy() should be called
> to destroy the memory pool that created by svc_create_memory_pool().
>
> Fixes: 7ca5ce896524 ("firmware: add Intel Stratix10 service layer driver")
> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
> ---
> drivers/firmware/stratix10-svc.c | 16 +++++++++++-----
> 1 file changed, 11 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/firmware/stratix10-svc.c b/drivers/firmware/stratix10-svc.c
> index b4081f4d88a3..1a5640b3ab42 100644
> --- a/drivers/firmware/stratix10-svc.c
> +++ b/drivers/firmware/stratix10-svc.c
> @@ -1138,13 +1138,17 @@ static int stratix10_svc_drv_probe(struct platform_device *pdev)
>
> /* allocate service controller and supporting channel */
> controller = devm_kzalloc(dev, sizeof(*controller), GFP_KERNEL);
> - if (!controller)
> - return -ENOMEM;
> + if (!controller) {
> + ret = -ENOMEM;
> + goto err_destroy_pool;
> + }
>
> chans = devm_kmalloc_array(dev, SVC_NUM_CHANNEL,
> sizeof(*chans), GFP_KERNEL | __GFP_ZERO);
> - if (!chans)
> - return -ENOMEM;
> + if (!chans) {
> + ret = -ENOMEM;
> + goto err_destroy_pool;
> + }
>
> controller->dev = dev;
> controller->num_chans = SVC_NUM_CHANNEL;
> @@ -1159,7 +1163,7 @@ static int stratix10_svc_drv_probe(struct platform_device *pdev)
> ret = kfifo_alloc(&controller->svc_fifo, fifo_size, GFP_KERNEL);
> if (ret) {
> dev_err(dev, "failed to allocate FIFO\n");
> - return ret;
> + goto err_destroy_pool;
> }
> spin_lock_init(&controller->svc_fifo_lock);
>
> @@ -1221,6 +1225,8 @@ static int stratix10_svc_drv_probe(struct platform_device *pdev)
>
> err_free_kfifo:
> kfifo_free(&controller->svc_fifo);
> +err_destroy_pool:
> + gen_pool_destroy(genpool);
> return ret;
> }
>
Acked-by: Dinh Nguyen <dinguyen@kernel.org>
next prev parent reply other threads:[~2022-11-07 19:56 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-03 7:09 [PATCH 0/2] firmware: stratix10-svc: fix error handle in stratix10_svc_drv_probe() Yang Yingliang
2022-11-03 7:09 ` [PATCH 1/2] firmware: stratix10-svc: add missing gen_pool_destroy() " Yang Yingliang
2022-11-07 19:56 ` Dinh Nguyen [this message]
2022-11-03 7:09 ` [PATCH 2/2] firmware: stratix10-svc: fix error handle while alloc/add device failed Yang Yingliang
2022-11-07 19:56 ` Dinh Nguyen
-- strict thread matches above, loose matches on Subject: below --
2022-11-29 16:36 [PATCH 1/2] firmware: stratix10-svc: add missing gen_pool_destroy() in stratix10_svc_drv_probe() Dinh Nguyen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=83accdc8-2a6f-fa7c-ed82-a7cafc3eda39@kernel.org \
--to=dinguyen@kernel.org \
--cc=atull@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=richard.gong@intel.com \
--cc=tien.sung.ang@intel.com \
--cc=yangyingliang@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox