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: 7104781 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 52F9CBF036 for ; Tue, 1 Sep 2015 10:48:51 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6DAD320456 for ; Tue, 1 Sep 2015 10:48:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7AF3B2058E for ; Tue, 1 Sep 2015 10:48:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755745AbbIAKsg (ORCPT ); Tue, 1 Sep 2015 06:48:36 -0400 Received: from mail-wi0-f171.google.com ([209.85.212.171]:35385 "EHLO mail-wi0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755731AbbIAKsd (ORCPT ); Tue, 1 Sep 2015 06:48:33 -0400 Received: by wicge5 with SMTP id ge5so2451906wic.0 for ; Tue, 01 Sep 2015 03:48: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:from:to:cc:subject:date:message-id:in-reply-to :references; bh=/RztMVue1xPlwMX4HBtuK32wZvao9Ftid1+I//mlT+A=; b=J5hsui25YSOYdQfBILKXM8EaR5+E/cwT6KjpWXPrhw8uTkioJSNaFtp7J+e0OolvME 5pQcMxkDxpdYV/vV6Qeof8a3czKUWHt6GwDV/rc1O/H+hxI+nF5YF5v5scVEvVk8eUD3 /QsYLm9pJoV0sccloMadAgoqXJgG/XhkEj8U5BFeZSj0roNCT0CZylZNEB+sPXQ8pGjk FNIfGNoh+PJOGVLBCNsRLcz8QYviQAkg98Fc68Ae1N70GyWSXu3Fr/Mrn5AasHuET8gU bQpQzODLX2BCehOywILfOUj4a/WhUjWnwv2GyvQywj5Jjo2ezcOvVTWfExMuTocr24hq 2Y0Q== X-Gm-Message-State: ALoCoQlFSB5516EVouX2Q5GobjivNb83rCJCtKFq5sn05/7/SH13wo6/JRSO6AI87gix8a2SqOa0 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-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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; }