diff mbox series

[4.19.y-cip,23/26] PCI: endpoint: Fix clearing start entry in configfs

Message ID 20201020145732.30343-24-prabhakar.mahadev-lad.rj@bp.renesas.com
State Accepted
Headers show
Series Fixes and extension to PCIe EPF | expand

Commit Message

Lad Prabhakar Oct. 20, 2020, 2:57 p.m. UTC
From: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>

commit f58d5f53c89479c12ad719c1960176442add5aaa upstream.

After an endpoint is started through configfs, if 0 is written to the
configfs entry 'start', the controller stops but the epc_group->start
value remains 1.

A subsequent unlinking of the function from the controller would trigger
a spurious WARN_ON_ONCE() in pci_epc_epf_unlink() despite right

Fix it by setting epc_group->start = 0 when a controller is stopped
using configfs.

Fixes: d74679911610 ("PCI: endpoint: Introduce configfs entry for configuring EP functions")
Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Acked-by: Kishon Vijay Abraham I <kishon@ti.com>
Cc: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
 drivers/pci/endpoint/pci-ep-cfs.c | 1 +
 1 file changed, 1 insertion(+)
diff mbox series


diff --git a/drivers/pci/endpoint/pci-ep-cfs.c b/drivers/pci/endpoint/pci-ep-cfs.c
index d1288a0bd530..4fead88257bb 100644
--- a/drivers/pci/endpoint/pci-ep-cfs.c
+++ b/drivers/pci/endpoint/pci-ep-cfs.c
@@ -58,6 +58,7 @@  static ssize_t pci_epc_start_store(struct config_item *item, const char *page,
 	if (!start) {
+		epc_group->start = 0;
 		return len;