Skip to content

Commit

Permalink
ion: don't use id 0 for handle cookie
Browse files Browse the repository at this point in the history
ion userspace clients think that the cookie is a pointer, so they
use NULL to check if the handle has been initialized.  Set the first
id number to 1.

Signed-off-by: Colin Cross <ccross@android.com>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Colin Cross authored and Greg Kroah-Hartman committed Dec 14, 2013
1 parent e1cf368 commit b4f8d24
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/staging/android/ion/ion.c
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ static int ion_handle_add(struct ion_client *client, struct ion_handle *handle)
rc = idr_pre_get(&client->idr, GFP_KERNEL);
if (!rc)
return -ENOMEM;
rc = idr_get_new(&client->idr, handle, &id);
rc = idr_get_new_above(&client->idr, handle, 1, &id);
handle->id = id;
} while (rc == -EAGAIN);

Expand Down

0 comments on commit b4f8d24

Please sign in to comment.