HSD #14018501141: free the fpga_mgr if the buffer allocation fails
Call fpga_mgr_unregister() to release the fpga mgr if send_buf fails
to get allocated.
Reported-by: Russ Weight <[email protected]>
Signed-off-by: Dinh Nguyen <[email protected]>
diff --git a/drivers/fpga/altera-cvp.c b/drivers/fpga/altera-cvp.c
index df8392a..6eec9f7 100644
--- a/drivers/fpga/altera-cvp.c
+++ b/drivers/fpga/altera-cvp.c
@@ -707,6 +707,7 @@ static int altera_cvp_probe(struct pci_dev *pdev,
conf->send_buf = devm_kzalloc(&pdev->dev, conf->priv->block_size, GFP_KERNEL);
if (!conf->send_buf) {
ret = -ENOMEM;
+ fpga_mgr_unregister(mgr);
goto err_unmap;
}
return 0;