Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/wq
[pandora-kernel.git] / arch / powerpc / platforms / powermac / pfunc_core.c
index ede49e7..b0c3777 100644 (file)
@@ -9,6 +9,7 @@
 #include <linux/delay.h>
 #include <linux/kernel.h>
 #include <linux/spinlock.h>
+#include <linux/slab.h>
 #include <linux/module.h>
 #include <linux/mutex.h>
 
@@ -836,8 +837,10 @@ struct pmf_function *__pmf_find_function(struct device_node *target,
                return NULL;
  find_it:
        dev = pmf_find_device(actor);
-       if (dev == NULL)
-               return NULL;
+       if (dev == NULL) {
+               result = NULL;
+               goto out;
+       }
 
        list_for_each_entry(func, &dev->functions, link) {
                if (name && strcmp(name, func->name))
@@ -849,8 +852,9 @@ struct pmf_function *__pmf_find_function(struct device_node *target,
                result = func;
                break;
        }
-       of_node_put(actor);
        pmf_put_device(dev);
+out:
+       of_node_put(actor);
        return result;
 }