Browse Source

staging: android: ion: dummy: fix dereference of ERR_PTR

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>
Sudip Mukherjee 9 years ago
parent
commit
9f563f1a2a
1 changed files with 2 additions and 0 deletions
  1. 2 0
      drivers/staging/android/ion/ion_dummy_driver.c

+ 2 - 0
drivers/staging/android/ion/ion_dummy_driver.c

@@ -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)