linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
To: gregkh@linuxfoundation.org
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH 13/13] nvmem: core: Avoid useless iterations in nvmem_cell_get_from_lookup()
Date: Mon, 28 Jan 2019 15:55:06 +0000	[thread overview]
Message-ID: <20190128155506.25566-14-srinivas.kandagatla@linaro.org> (raw)
In-Reply-To: <20190128155506.25566-1-srinivas.kandagatla@linaro.org>

From: Alban Bedel <albeu@free.fr>

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>
---
 drivers/nvmem/core.c | 5 ++---
 1 file 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;
 }
-- 
2.20.1


      parent reply	other threads:[~2019-01-28 17:35 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-28 15:54 [PATCH 00/13] nvmem: patches for 5.1 Srinivas Kandagatla
2019-01-28 15:54 ` [PATCH 01/13] nvmem: sc27xx: Convert nvmem offset to block index Srinivas Kandagatla
2019-01-28 15:54 ` [PATCH 02/13] nvmem: bcm-ocotp: Add ACPI support to BCM OCOTP Srinivas Kandagatla
2019-01-28 15:54 ` [PATCH 03/13] dt-bindings: nvmem: imx-ocotp: add compatible string for i.MX7ULP Srinivas Kandagatla
2019-01-28 15:54 ` [PATCH 04/13] nvmem: imx-ocotp: add i.MX7ULP support Srinivas Kandagatla
2019-01-28 15:54 ` [PATCH 05/13] dt-bindings: imx-ocotp: Add i.MX6ULL/ULZ support Srinivas Kandagatla
2019-01-28 15:54 ` [PATCH 06/13] nvmem: imx-ocotp: Implement " Srinivas Kandagatla
2019-01-28 15:55 ` [PATCH 07/13] nvmem: core: Set the provider read-only when no write callback is given Srinivas Kandagatla
2019-01-28 15:55 ` [PATCH 08/13] nvmem: core: Fix of_nvmem_cell_get() for optional cells Srinivas Kandagatla
2019-01-28 15:55 ` [PATCH 09/13] nvmem: core: Fix cell lookup when no cell is found Srinivas Kandagatla
2019-01-28 15:55 ` [PATCH 10/13] nvmem: core: Properly handle connection ID in of_nvmem_device_get() Srinivas Kandagatla
2019-01-28 15:55 ` [PATCH 11/13] nvmem: core: Always reference the device returned by nvmem_device_get() Srinivas Kandagatla
2019-01-28 15:55 ` [PATCH 12/13] nvmem: core: Fix device reference leak Srinivas Kandagatla
2019-01-28 15:55 ` Srinivas Kandagatla [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190128155506.25566-14-srinivas.kandagatla@linaro.org \
    --to=srinivas.kandagatla@linaro.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).