[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190510095832.28233-1-colin.king@canonical.com>
Date: Fri, 10 May 2019 10:58:32 +0100
From: Colin King <colin.king@...onical.com>
To: Philipp Zabel <p.zabel@...gutronix.de>,
Bartosz Golaszewski <bgolaszewski@...libre.com>
Cc: kernel-janitors@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH][V2] reset: remove redundant null check on pointer dev
From: Colin Ian King <colin.king@...onical.com>
Pointer dev is being dereferenced when passed to the inlined
functon dev_name, however, dev is later being null checked
so at first this seems like a potential null pointer dereference.
In fact, _reset_control_get_from_lookup is only ever called from
__reset_control_get, right after checking dev->of_node hence
dev can never be null. Clean this up by removing the redundant
null check.
Thanks to Philipp Zabel for spotting that dev can never be null.
Addresses-Coverity: ("Dereference before null check")
Fixes: 6691dffab0ab ("reset: add support for non-DT systems")
Signed-off-by: Colin Ian King <colin.king@...onical.com>
---
V2: remove null check point, it is redundant.
---
drivers/reset/core.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/drivers/reset/core.c b/drivers/reset/core.c
index 81ea77cba123..921f4bbbad8a 100644
--- a/drivers/reset/core.c
+++ b/drivers/reset/core.c
@@ -694,9 +694,6 @@ __reset_control_get_from_lookup(struct device *dev, const char *con_id,
const char *dev_id = dev_name(dev);
struct reset_control *rstc = NULL;
- if (!dev)
- return ERR_PTR(-EINVAL);
-
mutex_lock(&reset_lookup_mutex);
list_for_each_entry(lookup, &reset_lookup_list, list) {
--
2.20.1
Powered by blists - more mailing lists