Commit 9175ee1a authored by Yang Yingliang's avatar Yang Yingliang Committed by Greg Kroah-Hartman

firmware: stratix10-svc: add missing gen_pool_destroy() in stratix10_svc_drv_probe()

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: 7ca5ce89 ("firmware: add Intel Stratix10 service layer driver")
Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
Signed-off-by: default avatarDinh Nguyen <dinguyen@kernel.org>
Link: https://lore.kernel.org/r/20221129163602.462369-1-dinguyen@kernel.orgSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent ce4273d8
......@@ -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;
}
......
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