From d056c9b81918675c6dedbfae042c2329effad786 Mon Sep 17 00:00:00 2001
From: Philipp Zabel
Date: Tue, 8 Dec 2015 18:49:53 +0100
Subject: reset: remove unnecessary local variable initialization from
of_reset_control_get_by_index
There is no need to initialize rstc, as it is unconditionally
assigned the return value of a kzalloc call before use.
Signed-off-by: Philipp Zabel
---
drivers/reset/core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'drivers/reset/core.c')
diff --git a/drivers/reset/core.c b/drivers/reset/core.c
index 87376638948d..4a63b379361c 100644
--- a/drivers/reset/core.c
+++ b/drivers/reset/core.c
@@ -152,7 +152,7 @@ EXPORT_SYMBOL_GPL(reset_control_status);
struct reset_control *of_reset_control_get_by_index(struct device_node *node,
int index)
{
- struct reset_control *rstc = ERR_PTR(-EPROBE_DEFER);
+ struct reset_control *rstc;
struct reset_controller_dev *r, *rcdev;
struct of_phandle_args args;
int rstc_id;
--
cgit v1.2.3
From e677774f502635c70cb3180fc51ec7ff8c4b27ea Mon Sep 17 00:00:00 2001
From: Maxime Ripard
Date: Thu, 14 Jan 2016 16:24:44 +0100
Subject: reset: Move DT cell size check to the core
The core currently doesn't check that the DT cell size matches what the
driver declares, which means that every xlate function needs to duplicate
that check.
Make sure that of_reset_control_get checks for this to avoid duplication
and errors.
Signed-off-by: Maxime Ripard
Signed-off-by: Philipp Zabel
---
drivers/reset/core.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
(limited to 'drivers/reset/core.c')
diff --git a/drivers/reset/core.c b/drivers/reset/core.c
index 4a63b379361c..f15f150b79da 100644
--- a/drivers/reset/core.c
+++ b/drivers/reset/core.c
@@ -45,9 +45,6 @@ struct reset_control {
static int of_reset_simple_xlate(struct reset_controller_dev *rcdev,
const struct of_phandle_args *reset_spec)
{
- if (WARN_ON(reset_spec->args_count != rcdev->of_reset_n_cells))
- return -EINVAL;
-
if (reset_spec->args[0] >= rcdev->nr_resets)
return -EINVAL;
@@ -178,6 +175,11 @@ struct reset_control *of_reset_control_get_by_index(struct device_node *node,
return ERR_PTR(-EPROBE_DEFER);
}
+ if (WARN_ON(args.args_count != rcdev->of_reset_n_cells)) {
+ mutex_unlock(&reset_controller_list_mutex);
+ return ERR_PTR(-EINVAL);
+ }
+
rstc_id = rcdev->of_xlate(rcdev, &args);
if (rstc_id < 0) {
mutex_unlock(&reset_controller_list_mutex);
--
cgit v1.2.3