Merge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux
[~shefty/rdma-dev.git] / drivers / thermal / thermal_sys.c
index 1a19a2f..5b7863a 100644 (file)
@@ -131,23 +131,16 @@ EXPORT_SYMBOL_GPL(thermal_unregister_governor);
 
 static int get_idr(struct idr *idr, struct mutex *lock, int *id)
 {
-       int err;
-
-again:
-       if (unlikely(idr_pre_get(idr, GFP_KERNEL) == 0))
-               return -ENOMEM;
+       int ret;
 
        if (lock)
                mutex_lock(lock);
-       err = idr_get_new(idr, NULL, id);
+       ret = idr_alloc(idr, NULL, 0, 0, GFP_KERNEL);
        if (lock)
                mutex_unlock(lock);
-       if (unlikely(err == -EAGAIN))
-               goto again;
-       else if (unlikely(err))
-               return err;
-
-       *id = *id & MAX_IDR_MASK;
+       if (unlikely(ret < 0))
+               return ret;
+       *id = ret;
        return 0;
 }