diff options
Diffstat (limited to 'drivers/reset/core.c')
-rw-r--r-- | drivers/reset/core.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/reset/core.c b/drivers/reset/core.c index 87376638948d..f15f150b79da 100644 --- a/drivers/reset/core.c +++ b/drivers/reset/core.c | |||
@@ -45,9 +45,6 @@ struct reset_control { | |||
45 | static int of_reset_simple_xlate(struct reset_controller_dev *rcdev, | 45 | static int of_reset_simple_xlate(struct reset_controller_dev *rcdev, |
46 | const struct of_phandle_args *reset_spec) | 46 | const struct of_phandle_args *reset_spec) |
47 | { | 47 | { |
48 | if (WARN_ON(reset_spec->args_count != rcdev->of_reset_n_cells)) | ||
49 | return -EINVAL; | ||
50 | |||
51 | if (reset_spec->args[0] >= rcdev->nr_resets) | 48 | if (reset_spec->args[0] >= rcdev->nr_resets) |
52 | return -EINVAL; | 49 | return -EINVAL; |
53 | 50 | ||
@@ -152,7 +149,7 @@ EXPORT_SYMBOL_GPL(reset_control_status); | |||
152 | struct reset_control *of_reset_control_get_by_index(struct device_node *node, | 149 | struct reset_control *of_reset_control_get_by_index(struct device_node *node, |
153 | int index) | 150 | int index) |
154 | { | 151 | { |
155 | struct reset_control *rstc = ERR_PTR(-EPROBE_DEFER); | 152 | struct reset_control *rstc; |
156 | struct reset_controller_dev *r, *rcdev; | 153 | struct reset_controller_dev *r, *rcdev; |
157 | struct of_phandle_args args; | 154 | struct of_phandle_args args; |
158 | int rstc_id; | 155 | int rstc_id; |
@@ -178,6 +175,11 @@ struct reset_control *of_reset_control_get_by_index(struct device_node *node, | |||
178 | return ERR_PTR(-EPROBE_DEFER); | 175 | return ERR_PTR(-EPROBE_DEFER); |
179 | } | 176 | } |
180 | 177 | ||
178 | if (WARN_ON(args.args_count != rcdev->of_reset_n_cells)) { | ||
179 | mutex_unlock(&reset_controller_list_mutex); | ||
180 | return ERR_PTR(-EINVAL); | ||
181 | } | ||
182 | |||
181 | rstc_id = rcdev->of_xlate(rcdev, &args); | 183 | rstc_id = rcdev->of_xlate(rcdev, &args); |
182 | if (rstc_id < 0) { | 184 | if (rstc_id < 0) { |
183 | mutex_unlock(&reset_controller_list_mutex); | 185 | mutex_unlock(&reset_controller_list_mutex); |