diff mbox series

[v2,3/4] staging: vchiq: Simplify platform devices registration

Message ID 20221222191500.515795-4-umang.jain@ideasonboard.com
State New
Headers show
Series [v2,1/4] staging: vc04_services: Stop leaking platform device on error path | expand

Commit Message

Umang Jain Dec. 22, 2022, 7:14 p.m. UTC
The child platform devices registered by the vchiq driver currently
populates a struct platform_device_info with a name and parent device
and uses platform_device_register_full() to its registration.

It can be simplified by using platform_device_register_data() directly
(which encapsulates populating the platform_device_info struct and a
platform_device_register_full() call in itself).

Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
---
 .../vc04_services/interface/vchiq_arm/vchiq_arm.c      | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)
diff mbox series

Patch

diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
index 3c4766375daa..ba34e4d603d4 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
@@ -1766,16 +1766,10 @@  MODULE_DEVICE_TABLE(of, vchiq_of_match);
 static struct platform_device *
 vchiq_register_child(struct platform_device *pdev, const char *name)
 {
-	struct platform_device_info pdevinfo;
 	struct platform_device *child;
 
-	memset(&pdevinfo, 0, sizeof(pdevinfo));
-
-	pdevinfo.parent = &pdev->dev;
-	pdevinfo.name = name;
-	pdevinfo.id = PLATFORM_DEVID_NONE;
-
-	child = platform_device_register_full(&pdevinfo);
+	child = platform_device_register_data(&pdev->dev, name, PLATFORM_DEVID_NONE,
+					      NULL, 0);
 	if (IS_ERR(child)) {
 		dev_warn(&pdev->dev, "%s not registered\n", name);
 		platform_device_put(child);