diff options
author | Alan Tull <atull@kernel.org> | 2017-11-15 15:20:17 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-11-28 10:30:37 -0500 |
commit | 1743df83ae5a949037eb86a12f225abd4374d176 (patch) | |
tree | e06029a4151af58235388fabe2a197d7fa6b3cd7 /drivers/fpga/fpga-region.c | |
parent | 1df2dd7f587107ebf3c8e3733410627cf5c3b3ec (diff) |
fpga: region: check for child regions before allocing image info
During a device tree overlay pre-apply notification, the check
for child FPGA regions can happen slightly earlier. This saves
us from allocating the FPGA image info that just gets thrown
away.
This is a baby step in refactoring the FPGA region code to
separate out common FPGA region code from FPGA region
Device Tree overlay support.
Signed-off-by: Alan Tull <atull@kernel.org>
Acked-by: Moritz Fischer <mdf@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/fpga/fpga-region.c')
-rw-r--r-- | drivers/fpga/fpga-region.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/drivers/fpga/fpga-region.c b/drivers/fpga/fpga-region.c index d78f444c1350..afac5433978b 100644 --- a/drivers/fpga/fpga-region.c +++ b/drivers/fpga/fpga-region.c | |||
@@ -355,15 +355,19 @@ static int fpga_region_notify_pre_apply(struct fpga_region *region, | |||
355 | const char *firmware_name; | 355 | const char *firmware_name; |
356 | int ret; | 356 | int ret; |
357 | 357 | ||
358 | info = fpga_image_info_alloc(dev); | 358 | /* |
359 | if (!info) | 359 | * Reject overlay if child FPGA Regions added in the overlay have |
360 | return -ENOMEM; | 360 | * firmware-name property (would mean that an FPGA region that has |
361 | 361 | * not been added to the live tree yet is doing FPGA programming). | |
362 | /* Reject overlay if child FPGA Regions have firmware-name property */ | 362 | */ |
363 | ret = child_regions_with_firmware(nd->overlay); | 363 | ret = child_regions_with_firmware(nd->overlay); |
364 | if (ret) | 364 | if (ret) |
365 | return ret; | 365 | return ret; |
366 | 366 | ||
367 | info = fpga_image_info_alloc(dev); | ||
368 | if (!info) | ||
369 | return -ENOMEM; | ||
370 | |||
367 | /* Read FPGA region properties from the overlay */ | 371 | /* Read FPGA region properties from the overlay */ |
368 | if (of_property_read_bool(nd->overlay, "partial-fpga-config")) | 372 | if (of_property_read_bool(nd->overlay, "partial-fpga-config")) |
369 | info->flags |= FPGA_MGR_PARTIAL_RECONFIG; | 373 | info->flags |= FPGA_MGR_PARTIAL_RECONFIG; |