remoteproc: fix the error check for idr_alloc
authorSuman Anna <[email protected]>
Wed, 6 Mar 2013 22:56:48 +0000 (16:56 -0600)
committerOhad Ben-Cohen <[email protected]>
Fri, 5 Apr 2013 05:47:38 +0000 (08:47 +0300)
The new idr_alloc interface returns the allocated id back
on success, so fix the error path to check for negative
values. This was missed out in the newer idr interface
adoption patch, 15fc611 "remoteproc: convert to idr_alloc()".

Signed-off-by: Suman Anna <[email protected]>
Acked-by: Tejun Heo <[email protected]>
Signed-off-by: Ohad Ben-Cohen <[email protected]>
drivers/remoteproc/remoteproc_core.c

index 29387df4bfc9aa40f73cb94a0dcc2b2d0044af68..fb0fb342bf968f9e70b7af8b71f946ef34f72565 100644 (file)
@@ -217,7 +217,7 @@ int rproc_alloc_vring(struct rproc_vdev *rvdev, int i)
         * TODO: support predefined notifyids (via resource table)
         */
        ret = idr_alloc(&rproc->notifyids, rvring, 0, 0, GFP_KERNEL);
-       if (ret) {
+       if (ret < 0) {
                dev_err(dev, "idr_alloc failed: %d\n", ret);
                dma_free_coherent(dev->parent, size, va, dma);
                return ret;