@@ -165,10 +165,9 @@ long ion_ioctl(struct file *filp, unsign
data.allocation.flags, true);
if (IS_ERR(handle))
return PTR_ERR(handle);
- pass_to_user(handle);
data.allocation.handle = handle->id;
-
cleanup_handle = handle;
+ pass_to_user(handle);
break;
}
case ION_IOC_FREE:
@@ -212,11 +211,12 @@ long ion_ioctl(struct file *filp, unsign
if (IS_ERR(handle)) {
ret = PTR_ERR(handle);
} else {
+ data.handle.handle = handle->id;
handle = pass_to_user(handle);
- if (IS_ERR(handle))
+ if (IS_ERR(handle)) {
ret = PTR_ERR(handle);
- else
- data.handle.handle = handle->id;
+ data.handle.handle = 0;
+ }
}
break;
}