linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: peter.griffin@linaro.org (Peter Griffin)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v3 6/6] [media] c8sectpfe: Simplify for loop in load_slim_core_fw
Date: Fri, 28 Aug 2015 18:52:42 +0100	[thread overview]
Message-ID: <1440784362-31217-7-git-send-email-peter.griffin@linaro.org> (raw)
In-Reply-To: <1440784362-31217-1-git-send-email-peter.griffin@linaro.org>

Signed-off-by: Peter Griffin <peter.griffin@linaro.org>
---
 drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c b/drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c
index c691e13..ce72ffb 100644
--- a/drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c
+++ b/drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c
@@ -1096,7 +1096,7 @@ static int load_slim_core_fw(const struct firmware *fw, void *context)
 	Elf32_Ehdr *ehdr;
 	Elf32_Phdr *phdr;
 	u8 __iomem *dst;
-	int err, i;
+	int err = 0, i;
 
 	if (!fw || !context)
 		return -EINVAL;
@@ -1105,7 +1105,7 @@ static int load_slim_core_fw(const struct firmware *fw, void *context)
 	phdr = (Elf32_Phdr *)(fw->data + ehdr->e_phoff);
 
 	/* go through the available ELF segments */
-	for (i = 0; i < ehdr->e_phnum && !err; i++, phdr++) {
+	for (i = 0; i < ehdr->e_phnum; i++, phdr++) {
 
 		/* Only consider LOAD segments */
 		if (phdr->p_type != PT_LOAD)
@@ -1118,7 +1118,7 @@ static int load_slim_core_fw(const struct firmware *fw, void *context)
 			dev_err(fei->dev,
 				"Segment %d is outside of firmware file\n", i);
 			err = -EINVAL;
-			break;
+			goto err;
 		}
 
 		/*
@@ -1146,6 +1146,7 @@ static int load_slim_core_fw(const struct firmware *fw, void *context)
 		}
 	}
 
+err:
 	release_firmware(fw);
 	return err;
 }
-- 
1.9.1

      parent reply	other threads:[~2015-08-28 17:52 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-28 17:52 [PATCH v3 0/6] [media] c8sectpfe: Various fixups Peter Griffin
2015-08-28 17:52 ` [PATCH v3 1/6] ARM: DT: STi: stihxxx-b2120: Add pulse-width properties to ssc2 & ssc3 Peter Griffin
2015-08-28 17:52 ` [PATCH v3 2/6] ARM: DT: STi: STiH407: Add c8sectpfe LinuxDVB DT node Peter Griffin
2015-09-01  7:59   ` Lee Jones
2015-08-28 17:52 ` [PATCH v3 3/6] [media] c8sectpfe: Remove select on undefined LIBELF_32 Peter Griffin
2015-08-28 17:52 ` [PATCH v3 4/6] [media] c8sectpfe: Update binding to reset-gpios Peter Griffin
2015-08-31 15:25   ` Rob Herring
2015-09-01  7:58     ` Lee Jones
2015-09-01 10:12     ` Peter Griffin
2015-09-01  8:32   ` Javier Martinez Canillas
2015-09-01  9:09     ` Lee Jones
2015-09-01  9:16       ` Javier Martinez Canillas
2015-09-01  9:25         ` Lee Jones
2015-09-01 10:34         ` Peter Griffin
2015-09-01 12:09           ` Lee Jones
2015-09-01 11:54     ` Rob Herring
2015-09-01 12:30       ` Javier Martinez Canillas
2015-09-02 15:03       ` Peter Griffin
2015-08-28 17:52 ` [PATCH v3 5/6] [media] c8sectpfe: Update DT binding doc with some minor fixes Peter Griffin
2015-08-28 17:52 ` Peter Griffin [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=1440784362-31217-7-git-send-email-peter.griffin@linaro.org \
    --to=peter.griffin@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.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).