Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

fpga: of-fpga-region: Fail if any bridge is missing

When parsing the region bridge list from the "fpga-bridges" device tree
property, the of-fpga-region driver will silently ignore bridges which fail
to be obtained, for example due to a missing bridge driver or invalid
phandle.

This can lead to hardware issues if a region bridge stays coupled when
partial programming is performed.

Fail if any of the bridges specified in "fpga-bridges" cannot be obtained.

Signed-off-by: Romain Gantois <romain.gantois@bootlin.com>
Link: https://lore.kernel.org/r/20251127-of-fpga-region-fail-if-bridges-not-found-v1-1-ca674f8d07eb@bootlin.com
Reviewed-by: Xu Yilun <yilun.xu@intel.com>
Signed-off-by: Xu Yilun <yilun.xu@linux.intel.com>

authored by

Romain Gantois and committed by
Xu Yilun
c141c822 8f0b4cce

+4 -4
+4 -4
drivers/fpga/of-fpga-region.c
··· 83 83 * done with the bridges. 84 84 * 85 85 * Return: 0 for success (even if there are no bridges specified) 86 - * or -EBUSY if any of the bridges are in use. 86 + * or an error code if any of the bridges are not available. 87 87 */ 88 88 static int of_fpga_region_get_bridges(struct fpga_region *region) 89 89 { ··· 130 130 &region->bridge_list); 131 131 of_node_put(br); 132 132 133 - /* If any of the bridges are in use, give up */ 134 - if (ret == -EBUSY) { 133 + /* If any of the bridges are not available, give up */ 134 + if (ret) { 135 135 fpga_bridges_put(&region->bridge_list); 136 - return -EBUSY; 136 + return ret; 137 137 } 138 138 } 139 139