X86 platform drivers
 help / color / mirror / Atom feed
* [PATCH v2] x86/platform/goldfish: add a check for platform_device_register_simple
@ 2019-12-10  3:15 Chuhong Yuan
  0 siblings, 0 replies; only message in thread
From: Chuhong Yuan @ 2019-12-10  3:15 UTC (permalink / raw)
  Cc: Darren Hart, Andy Shevchenko, Thomas Gleixner, Ingo Molnar,
	Borislav Petkov, H . Peter Anvin, x86, platform-driver-x86,
	linux-kernel, Chuhong Yuan

goldfish_init() misses a check for platform_device_register_simple().
Add a check to fix it.

Fixes: ddd70cf93d78 ("goldfish: platform device for x86")
Signed-off-by: Chuhong Yuan <hslester96@gmail.com>
---
Changes in v2:
  - Use PLATFORM_DEVID_NONE instead of -1.
  - Use PTR_ERR_OR_ZERO() to simplify the code.

 arch/x86/platform/goldfish/goldfish.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/arch/x86/platform/goldfish/goldfish.c b/arch/x86/platform/goldfish/goldfish.c
index 6b6f8b4360dd..736f3fba234d 100644
--- a/arch/x86/platform/goldfish/goldfish.c
+++ b/arch/x86/platform/goldfish/goldfish.c
@@ -44,11 +44,14 @@ __setup("goldfish", goldfish_setup);
 
 static int __init goldfish_init(void)
 {
+	struct platform_device *pdev;
+
 	if (!goldfish_enable)
 		return -ENODEV;
 
-	platform_device_register_simple("goldfish_pdev_bus", -1,
-					goldfish_pdev_bus_resources, 2);
-	return 0;
+	pdev =  platform_device_register_simple("goldfish_pdev_bus",
+					 PLATFORM_DEVID_NONE,
+					 goldfish_pdev_bus_resources, 2);
+	return PTR_ERR_OR_ZERO(pdev);
 }
 device_initcall(goldfish_init);
-- 
2.24.0

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2019-12-10  3:15 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-12-10  3:15 [PATCH v2] x86/platform/goldfish: add a check for platform_device_register_simple Chuhong Yuan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox