From patchwork Thu Sep 3 17:59:54 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Griffin X-Patchwork-Id: 53041 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f72.google.com (mail-la0-f72.google.com [209.85.215.72]) by patches.linaro.org (Postfix) with ESMTPS id 459FC22E3F for ; Thu, 3 Sep 2015 18:10:58 +0000 (UTC) Received: by lagj9 with SMTP id j9sf19961892lag.0 for ; Thu, 03 Sep 2015 11:10:57 -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=iutACU4y98QTaDypHgTk9kxJLmVt3CAoFbhkbRcpzTe21d6FS2Zmy6J6sJFH2cY5S7 ksBAtZWQ8i1h4rvR3JyCMbKl4xfQ9rFbZolKCpcD3fMVBFKeBytgB8FTDNdPV3HXjiwL NsXY7wJM3VHLBPLB5LG+OE4wui0Woqc0xNykMpdVGONU161PZU7UHVXVrY8+ag/zt9Ii H3FSAolG4dW6osVs8AFtQNokkjglXTsCAQtdrZ4dHZDNUb5DTC6iSoKZCbLcIm7cPGKA FX1QstL5lg8eTljUR/OnzUzSYu2vsciWUWfXge6gTsqx2uXkLz7JpcLXBvB66Lzqq+A5 r+Zw== X-Gm-Message-State: ALoCoQkJ9g9rAG1c48dWHjhWnZ0o9B8AtrFbqf8GXNmaEhfYj/4DI6+x320IBSgJ2C6uPDDsEQwi X-Received: by 10.194.115.135 with SMTP id jo7mr11099273wjb.7.1441303857258; Thu, 03 Sep 2015 11:10:57 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.6.6 with SMTP id w6ls250298law.69.gmail; Thu, 03 Sep 2015 11:10:57 -0700 (PDT) X-Received: by 10.112.161.232 with SMTP id xv8mr23068661lbb.123.1441303857064; Thu, 03 Sep 2015 11:10:57 -0700 (PDT) Received: from mail-la0-f52.google.com (mail-la0-f52.google.com. [209.85.215.52]) by mx.google.com with ESMTPS id dx6si23809815lbc.64.2015.09.03.11.10.57 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 03 Sep 2015 11:10:57 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.52 as permitted sender) client-ip=209.85.215.52; Received: by lagj9 with SMTP id j9so34720153lag.2 for ; Thu, 03 Sep 2015 11:10:57 -0700 (PDT) X-Received: by 10.112.63.138 with SMTP id g10mr23312842lbs.106.1441303856848; Thu, 03 Sep 2015 11:10:56 -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.164.42 with SMTP id yn10csp1439374lbb; Thu, 3 Sep 2015 11:10:54 -0700 (PDT) X-Received: by 10.66.63.99 with SMTP id f3mr78985505pas.6.1441303853177; Thu, 03 Sep 2015 11:10:53 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id xc1si19578197pbc.23.2015.09.03.11.10.52; Thu, 03 Sep 2015 11:10:53 -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 S1758149AbbICSKv (ORCPT + 28 others); Thu, 3 Sep 2015 14:10:51 -0400 Received: from mail-wi0-f171.google.com ([209.85.212.171]:33796 "EHLO mail-wi0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758113AbbICSKf (ORCPT ); Thu, 3 Sep 2015 14:10:35 -0400 Received: by wicfx3 with SMTP id fx3so28474081wic.1 for ; Thu, 03 Sep 2015 11:10:34 -0700 (PDT) X-Received: by 10.181.13.166 with SMTP id ez6mr17413267wid.24.1441303834691; Thu, 03 Sep 2015 11:10:34 -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 lk16sm301526wic.6.2015.09.03.11.10.33 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 03 Sep 2015 11:10:34 -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, hugues.fruchet@st.com Subject: [PATCH v5 6/6] [media] c8sectpfe: Simplify for loop in load_slim_core_fw Date: Thu, 3 Sep 2015 18:59:54 +0100 Message-Id: <1441303194-28211-7-git-send-email-peter.griffin@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1441303194-28211-1-git-send-email-peter.griffin@linaro.org> References: <1441303194-28211-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.215.52 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; }