staging: android: ion_test: fix check of platform_device_register_simple() error...
authorVladimir Zapolskiy <vz@mleia.com>
Tue, 22 Mar 2016 22:38:43 +0000 (00:38 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 23 Mar 2016 02:27:36 +0000 (22:27 -0400)
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: 81fb0b901397 ("staging: android: ion_test: unregister the platform device")
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/android/ion/ion_test.c

index da34bc12cd7cc5f9db3ea74d8e41eccf139873d3..83a3af06d01c3c7f2a91b6a508d9fdad64e86464 100644 (file)
@@ -285,8 +285,8 @@ static int __init ion_test_init(void)
 {
        ion_test_pdev = platform_device_register_simple("ion-test",
                                                        -1, NULL, 0);
-       if (!ion_test_pdev)
-               return -ENODEV;
+       if (IS_ERR(ion_test_pdev))
+               return PTR_ERR(ion_test_pdev);
 
        return platform_driver_probe(&ion_test_platform_driver, ion_test_probe);
 }