aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorManivannan Sadhasivam <[email protected]>2023-06-02 17:17:50 +0530
committerBjorn Helgaas <[email protected]>2023-06-23 15:05:11 -0500
commita504c965588b781f864364e897917a2c7b48ea5b (patch)
tree398699fe7d40c64a10401e65dc356cf22df86bb8
parent081c715dfd50542e89df5ee12a8e32e7ed936cd1 (diff)
PCI: endpoint: Return error if EPC is started/stopped multiple times
When the EPC is started or stopped multiple times from configfs, just return -EALREADY. There is no need to call the EPC start/stop functions in those cases. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Manivannan Sadhasivam <[email protected]> Signed-off-by: Lorenzo Pieralisi <[email protected]> Signed-off-by: Bjorn Helgaas <[email protected]> Reviewed-by: Kishon Vijay Abraham I <[email protected]> Reviewed-by: Damien Le Moal <[email protected]>
-rw-r--r--drivers/pci/endpoint/pci-ep-cfs.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/pci/endpoint/pci-ep-cfs.c b/drivers/pci/endpoint/pci-ep-cfs.c
index 18e061af1d8e..0ea64e24ed61 100644
--- a/drivers/pci/endpoint/pci-ep-cfs.c
+++ b/drivers/pci/endpoint/pci-ep-cfs.c
@@ -179,6 +179,9 @@ static ssize_t pci_epc_start_store(struct config_item *item, const char *page,
if (kstrtobool(page, &start) < 0)
return -EINVAL;
+ if (start == epc_group->start)
+ return -EALREADY;
+
if (!start) {
pci_epc_stop(epc);
epc_group->start = 0;