diff mbox

[v2,09/16] fpga: region: fix slow warning with more than one overlay

Message ID 1492697401-11211-10-git-send-email-atull@kernel.org (mailing list archive)
State Superseded, archived
Headers show

Commit Message

Alan Tull April 20, 2017, 2:09 p.m. UTC
Prevent applying more than one overlay to a region.

This fixes a slow warning that happens when more than
one overlay is applied and then removed.

Signed-off-by: Alan Tull <atull@kernel.org>
---
v2: split out from another patch
---
 drivers/fpga/fpga-region.c | 5 +++++
 1 file changed, 5 insertions(+)
diff mbox

Patch

diff --git a/drivers/fpga/fpga-region.c b/drivers/fpga/fpga-region.c
index c2730a8..d6f2313 100644
--- a/drivers/fpga/fpga-region.c
+++ b/drivers/fpga/fpga-region.c
@@ -355,6 +355,11 @@  static int fpga_region_notify_pre_apply(struct fpga_region *region,
 	const char *firmware_name;
 	int ret;
 
+	if (region->info) {
+		dev_err(dev, "Region already has overlay applied.\n");
+		return -EINVAL;
+	}
+
 	/*
 	 * Reject overlay if child FPGA Regions added in the overlay have
 	 * firmware-name property (would mean that an FPGA region that has