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: 7118061 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id E75BE9F36E for ; Thu, 3 Sep 2015 18:11:10 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 229E420306 for ; Thu, 3 Sep 2015 18:11:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C52892042B for ; Thu, 3 Sep 2015 18:11:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758114AbbICSKu (ORCPT ); Thu, 3 Sep 2015 14:10:50 -0400 Received: from mail-wi0-f178.google.com ([209.85.212.178]:35573 "EHLO mail-wi0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758115AbbICSKf (ORCPT ); Thu, 3 Sep 2015 14:10:35 -0400 Received: by wicge5 with SMTP id ge5so82535114wic.0 for ; Thu, 03 Sep 2015 11:10:34 -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=l531iCTKZMQtctlJVQpRVIaHkhKvSJzIil538TdUmAI=; b=KkVOY6R1FQqcfqnvWefTxHerPWd3DnUF4S9xOx018YizZkQ887OlFakn67l+oQL+Sr zFPrCx8l80Ga5AIEka0fg162VZPb5seI3txjB4wzPYVqRiyHJ94HH55kzb7zQAzvfrov cpQ+ExTwkKk8sFiAO3r/57fWFl9jNvWvWA3/i7zeoNVdp8CFxBGe8UWxloLfD1N8I0wH NjikQQq1wK+gkVzenaHZVZkc4jw99buXVbnptjpMJiMyeM7vX73P9TdqmT32j66loekO 1J4tk04y3EsN0+XC+S9F6Xess3rK53tHG16trP47FBLKZ0z+KuL0VOonQBkxJdCTJV8P TNAg== X-Gm-Message-State: ALoCoQmtCxckQoh8oggwpDx/YQuSbT+aBBnSntn9ayZcw6bp6jcQHUHlBEW0JL4HKOwU2dHRQh9f 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-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=unavailable 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 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; }