]> Gentwo Git Trees - linux/.git/commit
misc: pci_endpoint_test: Give disabled BARs a distinct error code
authorNiklas Cassel <cassel@kernel.org>
Thu, 23 Jan 2025 12:01:48 +0000 (13:01 +0100)
committerKrzysztof Wilczyński <kwilczynski@kernel.org>
Thu, 20 Feb 2025 10:43:04 +0000 (10:43 +0000)
commite2a86691900d453a2da139c2dc07b8a6e9b26fd1
treeb209cc6f5b3249da1998b283155b4b972d107ff6
parent13dabb249193a674fb57dadfc09f3cb95e839626
misc: pci_endpoint_test: Give disabled BARs a distinct error code

The current code returns -ENOMEM if test->bar[barno] is NULL.

There can be two reasons why test->bar[barno] is NULL:

  1) The pci_ioremap_bar() call in pci_endpoint_test_probe() failed.
  2) The BAR was skipped, because it is disabled by the endpoint.

Many PCI endpoint controller drivers will disable all BARs in their
init function. A disabled BAR will have a size of 0.

A PCI endpoint function driver will be able to enable any BAR that
is not marked as BAR_RESERVED (which means that the BAR should not
be touched by the EPF driver).

Thus, perform check if the size is 0, before checking if
test->bar[barno] is NULL, such that we can return different errors.

This will allow the selftests to return SKIP instead of FAIL for
disabled BARs.

Signed-off-by: Niklas Cassel <cassel@kernel.org>
Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Link: https://lore.kernel.org/r/20250123120147.3603409-3-cassel@kernel.org
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
[kwilczynski: commit log]
Signed-off-by: Krzysztof Wilczyński <kwilczynski@kernel.org>
drivers/misc/pci_endpoint_test.c