From patchwork Fri Aug 28 17:52:42 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Griffin X-Patchwork-Id: 52802 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f197.google.com (mail-wi0-f197.google.com [209.85.212.197]) by patches.linaro.org (Postfix) with ESMTPS id D90C622EBF for ; Fri, 28 Aug 2015 17:53:32 +0000 (UTC) Received: by wibvo5 with SMTP id vo5sf5253866wib.0 for ; Fri, 28 Aug 2015 10:53:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=nBOkx1i2nrN75i4ETWfq8Cp7UY5PrTz5pBuWQ9KHL4I=; b=hCXNfkqCzNzs5Uu9dU+UsIZDey2TZVURotYO2/gNdTIGDFPJ+Y7QmnWd9UeSDholNa bDCTKAXdnh7E3KWtD7GEqge1K9gfyxamm967nbvgoXBetZQ8rIxycqSS90ogQIBkpZVo mOVOOCShGgIWp2+zhWVPigefdXOptY8USpX58yKIoCw9vjuWTbGdM9Q27RndO0bzFK47 eY1IIeJmoiD8CLu/CPSkT+SGYn48xPv1UJ6gd+H32Ec56+KXt+IoxFPDDotCDkmyEZ8A 4Efpmg1rWGSnLZ7Ei/B2eZ72wkvp1WyaPuGkh4bHflbZS9zMEwMdUYYdNFop2MLfd2vU IBMw== X-Gm-Message-State: ALoCoQmszFhAnh+aJ7bPffu+DFoMWlPj2UW4YhWQK+Fon5EPzYCFxNrq21EduPD2st7MYfx+qVjk X-Received: by 10.180.12.205 with SMTP id a13mr1465327wic.4.1440784412223; Fri, 28 Aug 2015 10:53:32 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.9.232 with SMTP id d8ls255726lab.13.gmail; Fri, 28 Aug 2015 10:53:32 -0700 (PDT) X-Received: by 10.152.120.7 with SMTP id ky7mr5816336lab.12.1440784412045; Fri, 28 Aug 2015 10:53:32 -0700 (PDT) Received: from mail-lb0-f173.google.com (mail-lb0-f173.google.com. [209.85.217.173]) by mx.google.com with ESMTPS id ph9si6421865lbb.120.2015.08.28.10.53.32 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 28 Aug 2015 10:53:32 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.173 as permitted sender) client-ip=209.85.217.173; Received: by lbbtg9 with SMTP id tg9so34446195lbb.1 for ; Fri, 28 Aug 2015 10:53:32 -0700 (PDT) X-Received: by 10.152.37.104 with SMTP id x8mr5263311laj.29.1440784411938; Fri, 28 Aug 2015 10:53:31 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.151.194 with SMTP id us2csp31610lbb; Fri, 28 Aug 2015 10:53:31 -0700 (PDT) X-Received: by 10.66.249.70 with SMTP id ys6mr17585746pac.100.1440784407791; Fri, 28 Aug 2015 10:53:27 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i10si11124415pdn.70.2015.08.28.10.53.26; Fri, 28 Aug 2015 10:53:27 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753442AbbH1RxJ (ORCPT + 28 others); Fri, 28 Aug 2015 13:53:09 -0400 Received: from mail-wi0-f176.google.com ([209.85.212.176]:34215 "EHLO mail-wi0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753417AbbH1RxF (ORCPT ); Fri, 28 Aug 2015 13:53:05 -0400 Received: by wiyy7 with SMTP id y7so6253007wiy.1 for ; Fri, 28 Aug 2015 10:53:04 -0700 (PDT) X-Received: by 10.180.82.106 with SMTP id h10mr3133018wiy.64.1440784384156; Fri, 28 Aug 2015 10:53:04 -0700 (PDT) Received: from localhost.localdomain (cpc14-aztw22-2-0-cust189.18-1.cable.virginm.net. [82.45.1.190]) by smtp.gmail.com with ESMTPSA id d7sm4781243wiz.22.2015.08.28.10.53.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 28 Aug 2015 10:53:03 -0700 (PDT) From: Peter Griffin To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, srinivas.kandagatla@gmail.com, maxime.coquelin@st.com, patrice.chotard@st.com, mchehab@osg.samsung.com Cc: peter.griffin@linaro.org, lee.jones@linaro.org, linux-media@vger.kernel.org, devicetree@vger.kernel.org, valentinrothberg@gmail.com, hugues.fruchet@st.com Subject: [PATCH v3 6/6] [media] c8sectpfe: Simplify for loop in load_slim_core_fw Date: Fri, 28 Aug 2015 18:52:42 +0100 Message-Id: <1440784362-31217-7-git-send-email-peter.griffin@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1440784362-31217-1-git-send-email-peter.griffin@linaro.org> References: <1440784362-31217-1-git-send-email-peter.griffin@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: peter.griffin@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.173 as permitted sender) smtp.mailfrom=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Signed-off-by: Peter Griffin --- 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; }