fpga: of-fpga-region: accept overlays that don't program FPGA

The FPGA may already have a static image programmed when
Linux boots.  In that case a DT overlay may be used to add
the devices that already exist.  This commit allows that
by shuffling the order of some checks.

Signed-off-by: Alan Tull <atull@kernel.org>
Acked-by: Moritz Fischer <mdf@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Alan Tull 2017-11-15 14:20:26 -06:00 committed by Greg Kroah-Hartman
parent ef3acdd820
commit 8a54167925

View file

@ -298,18 +298,19 @@ static int of_fpga_region_notify_pre_apply(struct fpga_region *region,
struct fpga_image_info *info;
int ret;
if (region->info) {
dev_err(dev, "Region already has overlay applied.\n");
return -EINVAL;
}
info = of_fpga_region_parse_ov(region, nd->overlay);
if (IS_ERR(info))
return PTR_ERR(info);
/* If overlay doesn't program the FPGA, accept it anyway. */
if (!info)
return 0;
if (region->info) {
dev_err(dev, "Region already has overlay applied.\n");
return -EINVAL;
}
region->info = info;
ret = fpga_region_program_fpga(region);
if (ret) {