staging: android: ion: dummy: fix dereference of ERR_PTR
authorSudip Mukherjee <sudipm.mukherjee@gmail.com>
Thu, 7 Apr 2016 16:32:25 +0000 (22:02 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 30 Apr 2016 00:40:50 +0000 (17:40 -0700)
ion_device_create() can fail and if it fails then it returns the error
value in ERR_PTR.

Signed-off-by: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk>
Reviewed-by: Laura Abbott <labbott@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/android/ion/ion_dummy_driver.c

index 5678870bff4850cbdf53eff4d58cc29b7df84434..814a3c92a56ef5aa3095fc416b7fcc004105434f 100644 (file)
@@ -68,6 +68,8 @@ static int __init ion_dummy_init(void)
        int i, err;
 
        idev = ion_device_create(NULL);
+       if (IS_ERR(idev))
+               return PTR_ERR(idev);
        heaps = kcalloc(dummy_ion_pdata.nr, sizeof(struct ion_heap *),
                        GFP_KERNEL);
        if (!heaps)