linux/drivers/pci/endpoint
Krzysztof Wilczyński 36f354ec7b PCI/sysfs: Return -EINVAL consistently from "store" functions
Most of the "store" functions that handle userspace input via sysfs return
-EINVAL should the value fail validation and/or type conversion.  This
error code is a clear message to userspace that the value is not a valid
input.

However, some of the "show" functions return input parsing error codes
as-is, which may be either -EINVAL or -ERANGE.  The former would often be
from kstrtobool(), and the latter typically from other kstr*() functions
such as kstrtou8(), kstrtou32(), kstrtoint(), etc.

-EINVAL is commonly returned as the error code to indicate that the value
provided is invalid, but -ERANGE is not very useful in userspace.

Therefore, normalize the return error code to be -EINVAL for when the
validation and/or type conversion fails.

Link: https://lore.kernel.org/r/20210915230127.2495723-2-kw@linux.com
Signed-off-by: Krzysztof Wilczyński <kw@linux.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
2021-09-28 17:47:04 -05:00
..
functions PCI/sysfs: Return -EINVAL consistently from "store" functions 2021-09-28 17:47:04 -05:00
Kconfig PCI: consolidate PCI config entry in drivers/pci 2018-11-23 11:45:34 +09:00
Makefile PCI: Add SPDX GPL-2.0 when no license was specified 2018-01-26 11:45:16 -06:00
pci-ep-cfs.c PCI/sysfs: Return -EINVAL consistently from "store" functions 2021-09-28 17:47:04 -05:00
pci-epc-core.c PCI: endpoint: Add virtual function number in pci_epc ops 2021-08-19 14:13:28 +01:00
pci-epc-mem.c PCI: Fix kerneldoc warnings 2020-08-05 18:23:14 -05:00
pci-epf-core.c pci-v5.15-changes 2021-09-07 19:13:42 -07:00