Commit e73bbf64 authored by Tobias Klauser's avatar Tobias Klauser Committed by Greg Kroah-Hartman

fpga: region: release FPGA region reference in error path

If fpga_region_get_manager() fails in fpga_region_program_fpga(), a
reference to the fpga_manager instance previously acquired through
fpga_region_get() is retained. Make sure to properly release it in the
error case by using a separate jump label which will call
fpga_region_put() in before returning.
Signed-off-by: default avatarTobias Klauser <>
Acked-by: default avatarMoritz Fischer <>
Signed-off-by: default avatarAlan Tull <>
Signed-off-by: default avatarGreg Kroah-Hartman <>
parent d721f9bb
......@@ -245,7 +245,8 @@ static int fpga_region_program_fpga(struct fpga_region *region,
mgr = fpga_region_get_manager(region);
if (IS_ERR(mgr)) {
pr_err("failed to get fpga region manager\n");
return PTR_ERR(mgr);
ret = PTR_ERR(mgr);
goto err_put_region;
ret = fpga_region_get_bridges(region, overlay);
......@@ -281,6 +282,7 @@ static int fpga_region_program_fpga(struct fpga_region *region,
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