bus/platform: probe devices without resources

Message ID 20230313070735.2555186-1-tduszynski@marvell.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers
Series bus/platform: probe devices without resources |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/Intel-compilation success Compilation OK
ci/intel-Functional success Functional PASS
ci/intel-Testing success Testing PASS
ci/github-robot: build success github build: passed
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-aarch64-unit-testing success Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/iol-abi-testing success Testing PASS

Commit Message

Tomasz Duszynski March 13, 2023, 7:07 a.m. UTC
  Platform device does not necessarily need to have any resources
defined. That means device is only capable of doing DMA transfers
and platform bus should not hinder a valid use-case.

Signed-off-by: Tomasz Duszynski <tduszynski@marvell.com>
---
 drivers/bus/platform/platform.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
  

Comments

Thomas Monjalon March 16, 2023, 4:49 p.m. UTC | #1
13/03/2023 08:07, Tomasz Duszynski:
> Platform device does not necessarily need to have any resources
> defined. That means device is only capable of doing DMA transfers
> and platform bus should not hinder a valid use-case.
> 
> Signed-off-by: Tomasz Duszynski <tduszynski@marvell.com>

Applied, thanks.
  

Patch

diff --git a/drivers/bus/platform/platform.c b/drivers/bus/platform/platform.c
index 536d9524c6..8a73f4d7e1 100644
--- a/drivers/bus/platform/platform.c
+++ b/drivers/bus/platform/platform.c
@@ -269,8 +269,10 @@  device_map_resources(struct rte_platform_device *pdev, unsigned int num)
 	unsigned int i;
 	int ret;
 
-	if (num == 0)
+	if (num == 0) {
 		PLATFORM_LOG(WARNING, "device %s has no resources\n", pdev->name);
+		return 0;
+	}
 
 	pdev->resource = calloc(num, sizeof(*pdev->resource));
 	if (pdev->resource == NULL)