Skip to content

Commit a504c96

Browse files
Mani-Sadhasivambjorn-helgaas
authored andcommitted
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/20230602114756.36586-4-manivannan.sadhasivam@linaro.org Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> Signed-off-by: Lorenzo Pieralisi <lpieralisi@kernel.org> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Reviewed-by: Kishon Vijay Abraham I <kishon@kernel.org> Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
1 parent 081c715 commit a504c96

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

drivers/pci/endpoint/pci-ep-cfs.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,9 @@ static ssize_t pci_epc_start_store(struct config_item *item, const char *page,
179179
if (kstrtobool(page, &start) < 0)
180180
return -EINVAL;
181181

182+
if (start == epc_group->start)
183+
return -EALREADY;
184+
182185
if (!start) {
183186
pci_epc_stop(epc);
184187
epc_group->start = 0;

0 commit comments

Comments
 (0)