Commit 263b0af7 authored by Vladimir Zapolskiy's avatar Vladimir Zapolskiy Committed by Greg Kroah-Hartman

staging: android: ion_test: fix check of platform_device_register_simple() error code

commit ccbc2a9e upstream.

On error platform_device_register_simple() returns ERR_PTR() value,
check for NULL always fails. The change corrects the check itself and
propagates the returned error upwards.

Fixes: 81fb0b90 ("staging: android: ion_test: unregister the platform device")
Signed-off-by: default avatarVladimir Zapolskiy <vz@mleia.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent a5e8deb7
...@@ -285,8 +285,8 @@ static int __init ion_test_init(void) ...@@ -285,8 +285,8 @@ static int __init ion_test_init(void)
{ {
ion_test_pdev = platform_device_register_simple("ion-test", ion_test_pdev = platform_device_register_simple("ion-test",
-1, NULL, 0); -1, NULL, 0);
if (!ion_test_pdev) if (IS_ERR(ion_test_pdev))
return -ENODEV; return PTR_ERR(ion_test_pdev);
return platform_driver_probe(&ion_test_platform_driver, ion_test_probe); return platform_driver_probe(&ion_test_platform_driver, ion_test_probe);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment