From: Manivannan Sadhasivam Date: Fri, 2 Jun 2023 11:47:50 +0000 (+0530) Subject: PCI: endpoint: Return error if EPC is started/stopped multiple times X-Git-Tag: v6.6.7~2484^2~1^2~8 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a504c965588b781f864364e897917a2c7b48ea5b;p=platform%2Fkernel%2Flinux-starfive.git 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 Signed-off-by: Lorenzo Pieralisi Signed-off-by: Bjorn Helgaas Reviewed-by: Kishon Vijay Abraham I Reviewed-by: Damien Le Moal --- diff --git a/drivers/pci/endpoint/pci-ep-cfs.c b/drivers/pci/endpoint/pci-ep-cfs.c index 18e061a..0ea64e2 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;