diff mbox series

[v2] PCI: endpoint: Fix clearing start entry in configfs

Message ID 1582696343-23049-1-git-send-email-hayashi.kunihiko@socionext.com
State New
Headers show
Series [v2] PCI: endpoint: Fix clearing start entry in configfs | expand

Commit Message

Kunihiko Hayashi Feb. 26, 2020, 5:52 a.m. UTC
After endpoint has started using configfs, if 0 is written to the entry
'start', the controller stops but the entry value remains 1.

At this time, unlinking the function from the controller, WARN_ON_ONCE()
in pci_epc_epf_unlink() will be triggered despite right behavior.

This fixes the issue by clearing the entry when stopping the controller.

Fixes: d74679911610 ("PCI: endpoint: Introduce configfs entry for configuring EP functions")
Cc: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
Acked-by: Kishon Vijay Abraham I <kishon@ti.com>
---
 drivers/pci/endpoint/pci-ep-cfs.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Lorenzo Pieralisi March 11, 2020, 11:18 a.m. UTC | #1
On Wed, Feb 26, 2020 at 02:52:23PM +0900, Kunihiko Hayashi wrote:
> After endpoint has started using configfs, if 0 is written to the entry
> 'start', the controller stops but the entry value remains 1.
> 
> At this time, unlinking the function from the controller, WARN_ON_ONCE()
> in pci_epc_epf_unlink() will be triggered despite right behavior.
> 
> This fixes the issue by clearing the entry when stopping the controller.
> 
> Fixes: d74679911610 ("PCI: endpoint: Introduce configfs entry for configuring EP functions")
> Cc: Kishon Vijay Abraham I <kishon@ti.com>
> Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
> Acked-by: Kishon Vijay Abraham I <kishon@ti.com>
> ---
>  drivers/pci/endpoint/pci-ep-cfs.c | 1 +
>  1 file changed, 1 insertion(+)

Applied to pci/endpoint for v5.7.

Thanks,
Lorenzo

> 
> diff --git a/drivers/pci/endpoint/pci-ep-cfs.c b/drivers/pci/endpoint/pci-ep-cfs.c
> index d1288a0..4fead88 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) {
>  		pci_epc_stop(epc);
> +		epc_group->start = 0;
>  		return len;
>  	}
>  
> -- 
> 2.7.4
>
diff mbox series

Patch

diff --git a/drivers/pci/endpoint/pci-ep-cfs.c b/drivers/pci/endpoint/pci-ep-cfs.c
index d1288a0..4fead88 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) {
 		pci_epc_stop(epc);
+		epc_group->start = 0;
 		return len;
 	}