summaryrefslogtreecommitdiffstats
path: root/drivers/nvmem
diff options
context:
space:
mode:
authorAlban Bedel <albeu@free.fr>2019-01-28 16:55:06 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-01-31 16:24:15 +0100
commit9bfd8198ba948e11a0f9c618db00b0d4020b71c5 (patch)
treeaed8d30a3de51bfa7cda7c760ba8d0edb888d961 /drivers/nvmem
parentnvmem: core: Fix device reference leak (diff)
downloadlinux-9bfd8198ba948e11a0f9c618db00b0d4020b71c5.tar.xz
linux-9bfd8198ba948e11a0f9c618db00b0d4020b71c5.zip
nvmem: core: Avoid useless iterations in nvmem_cell_get_from_lookup()
Once the correct cell has been found there is no need to continue iterating, just stop there. While at it replace the goto used to leave the loop with simple break statements. Signed-off-by: Alban Bedel <albeu@free.fr> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/nvmem')
-rw-r--r--drivers/nvmem/core.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c
index 5400017ef616..9dd07eae1f3e 100644
--- a/drivers/nvmem/core.c
+++ b/drivers/nvmem/core.c
@@ -977,7 +977,7 @@ nvmem_cell_get_from_lookup(struct device *dev, const char *con_id)
if (IS_ERR(nvmem)) {
/* Provider may not be registered yet. */
cell = ERR_CAST(nvmem);
- goto out;
+ break;
}
cell = nvmem_find_cell_by_name(nvmem,
@@ -985,12 +985,11 @@ nvmem_cell_get_from_lookup(struct device *dev, const char *con_id)
if (!cell) {
__nvmem_device_put(nvmem);
cell = ERR_PTR(-ENOENT);
- goto out;
}
+ break;
}
}
-out:
mutex_unlock(&nvmem_lookup_mutex);
return cell;
}