diff options
author | Enrico Scholz <enrico.scholz@sigma-chemnitz.de> | 2021-02-10 15:27:04 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2021-02-12 11:17:33 +0100 |
commit | 3a5917ddaedb1256a712a6287f7f050038021a98 (patch) | |
tree | bb2ff43bea18aa772d36a5176939a697c29d2d3b /drivers | |
parent | 946064e7835a0fb8ac3f78c316a43605975ab1a1 (diff) | |
download | barebox-3a5917ddaedb1256a712a6287f7f050038021a98.tar.gz barebox-3a5917ddaedb1256a712a6287f7f050038021a98.tar.xz |
nvmem: avoid false positive in of_nvmem_find() and simplify it
of_nvmem_find() compared only the node names which can return the
wrong device in setups like
| &i2c1 {
| eeprom@50 {
| };
| };
| &i2c2 {
| eeprom@50 {
| };
| };
Instead of checking the complete path ('full_name' attribute), the
patch compares the device_node pointers directly.
This is done in other places (e.g. of_find_i2c_adapter_by_node()) and
in the linux kernel too.
Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/nvmem/core.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c index 06e1414769..02d0af6e1d 100644 --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c @@ -129,7 +129,7 @@ static struct nvmem_device *of_nvmem_find(struct device_node *nvmem_np) return NULL; list_for_each_entry(dev, &nvmem_devs, node) - if (dev->dev.device_node->name && !strcmp(dev->dev.device_node->name, nvmem_np->name)) + if (dev->dev.device_node == nvmem_np) return dev; return NULL; |