]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - drivers/reset/core.c
Merge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost
[linux.git] / drivers / reset / core.c
index 225e34c56b94a2e315f17a598bd7a74d6dae1932..d1887c0ed5d3f2aa7e51f94f5f9e61cbf50ca5ea 100644 (file)
@@ -496,28 +496,29 @@ struct reset_control *__of_reset_control_get(struct device_node *node,
                        break;
                }
        }
-       of_node_put(args.np);
 
        if (!rcdev) {
-               mutex_unlock(&reset_list_mutex);
-               return ERR_PTR(-EPROBE_DEFER);
+               rstc = ERR_PTR(-EPROBE_DEFER);
+               goto out;
        }
 
        if (WARN_ON(args.args_count != rcdev->of_reset_n_cells)) {
-               mutex_unlock(&reset_list_mutex);
-               return ERR_PTR(-EINVAL);
+               rstc = ERR_PTR(-EINVAL);
+               goto out;
        }
 
        rstc_id = rcdev->of_xlate(rcdev, &args);
        if (rstc_id < 0) {
-               mutex_unlock(&reset_list_mutex);
-               return ERR_PTR(rstc_id);
+               rstc = ERR_PTR(rstc_id);
+               goto out;
        }
 
        /* reset_list_mutex also protects the rcdev's reset_control list */
        rstc = __reset_control_get_internal(rcdev, rstc_id, shared);
 
+out:
        mutex_unlock(&reset_list_mutex);
+       of_node_put(args.np);
 
        return rstc;
 }