From patchwork Tue Sep 1 10:48:14 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Griffin X-Patchwork-Id: 52922 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f70.google.com (mail-la0-f70.google.com [209.85.215.70]) by patches.linaro.org (Postfix) with ESMTPS id 59C342157D for ; Tue, 1 Sep 2015 10:48:47 +0000 (UTC) Received: by laboe4 with SMTP id oe4sf36941142lab.3 for ; Tue, 01 Sep 2015 03:48:46 -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=Y7nKVisZnvjIdxrQgZLsfGpP1JC77jjfDWcApix8724=; b=i8XhCu5v9oZBOoAzvEOi0Ovq10YoL/NL+DNV7Oal7n9nULC7rMKxuUcABvBcRdeZDw 3L37sPp44eN1KxikjT06UPJU9VnSeNsKKRZbpjCpNj2dUW+YUEtkYg9o7pmn7x8YF8fO aEGQPLa71s/dxftOlTyLO9a4JTQY3ImZCKifZmCLgCCKEIM+QRE0qqRHy7mfBzCvBT4t HbrlERDMTpMRPtxF358Vi3i0qXV6CBqmp1c+FtoLrk0Dn5h1uCYRoDZ6wccFaY/Ftr6+ huiDT8Af+QYncXpUc/dA1v86H6NDQrb3SVP3SIWpV7opLCb1KQ3BpdLPlth9tRE42SEo GSOA== X-Gm-Message-State: ALoCoQl3tkeFN5wlLEF7G7rvKvdDJGQ9n7X3b7Rq4M/N235EJ3KjGmktjs9jYpluZ146bP5dEXhz X-Received: by 10.112.148.101 with SMTP id tr5mr7447041lbb.13.1441104526332; Tue, 01 Sep 2015 03:48:46 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.204.40 with SMTP id kv8ls560370lac.94.gmail; Tue, 01 Sep 2015 03:48:46 -0700 (PDT) X-Received: by 10.112.209.106 with SMTP id ml10mr12523930lbc.112.1441104526022; Tue, 01 Sep 2015 03:48:46 -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 oc2si16070352lbb.76.2015.09.01.03.48.45 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 01 Sep 2015 03:48:45 -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 laboe4 with SMTP id oe4so63622690lab.0 for ; Tue, 01 Sep 2015 03:48:45 -0700 (PDT) X-Received: by 10.152.5.228 with SMTP id v4mr13008282lav.36.1441104525919; Tue, 01 Sep 2015 03:48:45 -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 yn10csp442598lbb; Tue, 1 Sep 2015 03:48:45 -0700 (PDT) X-Received: by 10.68.89.35 with SMTP id bl3mr2230721pbb.69.1441104523387; Tue, 01 Sep 2015 03:48:43 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t2si29112080pbs.163.2015.09.01.03.48.42; Tue, 01 Sep 2015 03:48:43 -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 S1755800AbbIAKsh (ORCPT + 28 others); Tue, 1 Sep 2015 06:48:37 -0400 Received: from mail-wi0-f169.google.com ([209.85.212.169]:33174 "EHLO mail-wi0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755735AbbIAKsd (ORCPT ); Tue, 1 Sep 2015 06:48:33 -0400 Received: by wicmc4 with SMTP id mc4so28334456wic.0 for ; Tue, 01 Sep 2015 03:48:32 -0700 (PDT) X-Received: by 10.180.149.208 with SMTP id uc16mr2597716wib.7.1441104512641; Tue, 01 Sep 2015 03:48:32 -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 gt10sm2093822wib.20.2015.09.01.03.48.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 01 Sep 2015 03:48:31 -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 v4 6/6] [media] c8sectpfe: Simplify for loop in load_slim_core_fw Date: Tue, 1 Sep 2015 11:48:14 +0100 Message-Id: <1441104494-10468-7-git-send-email-peter.griffin@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1441104494-10468-1-git-send-email-peter.griffin@linaro.org> References: <1441104494-10468-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 e19c6b4..782174a 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; }