Received: by 10.223.164.221 with SMTP id h29csp2758070wrb; Thu, 2 Nov 2017 17:25:00 -0700 (PDT) X-Google-Smtp-Source: ABhQp+REqCpSUPXfRGtyXAaWaQbRsYEmUA+pHXpwEkFuG7u8ANe62UXSIotLTkh+Ajdk26lPejP7 X-Received: by 10.99.47.6 with SMTP id v6mr5315153pgv.452.1509668700672; Thu, 02 Nov 2017 17:25:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1509668700; cv=none; d=google.com; s=arc-20160816; b=NBPrW5n8gyHpq0z4BGQsN6YgnbuskYubdeeEiHM3y6ZNHHokhPg8KIZ4K3kb1FrLbE tzXdRu2b0yKqv+PE2Xu4jnVmM0DaLnOFvkETioTORpRNvT05ZCAlzcEqbR/Mjy/Fj+xe H6i+2K0hu815P0cQjY/p53d1oBcC6y5V6SQyzu4+BrYFdOyFbMYAfMlXod5fWLzxGpsC J/QayO+5n+rqUwVQdboOwHKKJHp7qXlo6SthxE4zL8tsikviGFwxUQ/EBQc6g0t94QhC tNntVNR/RsH7XA6WP9Z0iHqC8HqdS481tL17pOlJqssV/fi3owRS0/q22BDEWrIz2PFW bhIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=ZCeDbQ39wdqGljBG2lTLFf2nmNU1+zst8gcmeI9QQes=; b=Fs1aehLHXQkCbupT9RZLwcIIoGmZ9PRuqzeYkuuTvhNEFrzykgKeJHyu4nvrGKk1/j rZ4p6cs5WahFoG+L+t1Ixc7R00pLMZpEZcTxaKZhGCIl92OHvQiBrbEjuMCK+yjHK4DP 2r07PINH9gbEFyhG2riYqvcjmRSAbjM1i3OMQNpyhwIc2nrbvYuTBQKTmmjv/mYkXXoH DCQIhJQb/T7NihpsdJ99WBK42lZO05+2yNhIzrJl/KzkiFRAWBNA5fHsiVyq4BPkAZu0 qpUTAi8/wAHN2Fn3EoL6nb1Olxa6jqnqPv+7Myyf+OJJRRcbyA3zW7HB6VrGseQQJTuE TjFA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u127si4566975pgc.803.2017.11.02.17.24.47; Thu, 02 Nov 2017 17:25:00 -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; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934718AbdKCAX7 (ORCPT + 96 others); Thu, 2 Nov 2017 20:23:59 -0400 Received: from osg.samsung.com ([64.30.133.232]:33871 "EHLO osg.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934556AbdKCAX5 (ORCPT ); Thu, 2 Nov 2017 20:23:57 -0400 Received: from localhost (localhost [127.0.0.1]) by osg.samsung.com (Postfix) with ESMTP id 469F217C30; Thu, 2 Nov 2017 17:23:57 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at dev.s-opensource.com Received: from osg.samsung.com ([127.0.0.1]) by localhost (localhost [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id W8N07HXrV8YW; Thu, 2 Nov 2017 17:23:55 -0700 (PDT) Received: from [192.168.1.87] (c-24-9-64-241.hsd1.co.comcast.net [24.9.64.241]) by osg.samsung.com (Postfix) with ESMTPSA id BD44517C25; Thu, 2 Nov 2017 17:23:54 -0700 (PDT) Subject: Re: [PATCH 1/2] media: s5p-mfc: check for firmware allocation before requesting firmware To: Andrzej Hajda , kyungmin.park@samsung.com, kamil@wypas.org, jtp.park@samsung.com, mchehab@kernel.org Cc: linux-arm-kernel@lists.infradead.org, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Shuah Khan References: <5bbc048a-4b68-de23-373d-eb8a12c5b736@samsung.com> From: Shuah Khan Message-ID: <9b86cd70-9063-bf45-6851-73c2f982de5b@osg.samsung.com> Date: Thu, 2 Nov 2017 18:23:54 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <5bbc048a-4b68-de23-373d-eb8a12c5b736@samsung.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/02/2017 02:12 AM, Andrzej Hajda wrote: > Hi Shuah, > > On 06.10.2017 23:30, Shuah Khan wrote: >> Check if firmware is allocated before requesting firmware instead of >> requesting firmware only to release it if firmware is not allocated. >> >> Signed-off-by: Shuah Khan >> --- >> drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c | 10 +++++----- >> 1 file changed, 5 insertions(+), 5 deletions(-) >> >> diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c b/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c >> index 69ef9c2..f064a0d1 100644 >> --- a/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c >> +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c >> @@ -55,6 +55,11 @@ int s5p_mfc_load_firmware(struct s5p_mfc_dev *dev) >> * into kernel. */ >> mfc_debug_enter(); >> >> + if (!dev->fw_buf.virt) { >> + mfc_err("MFC firmware is not allocated\n"); >> + return -EINVAL; >> + } >> + >> for (i = MFC_FW_MAX_VERSIONS - 1; i >= 0; i--) { >> if (!dev->variant->fw_name[i]) >> continue; >> @@ -75,11 +80,6 @@ int s5p_mfc_load_firmware(struct s5p_mfc_dev *dev) >> release_firmware(fw_blob); >> return -ENOMEM; >> } >> - if (!dev->fw_buf.virt) { >> - mfc_err("MFC firmware is not allocated\n"); >> - release_firmware(fw_blob); >> - return -EINVAL; >> - } > > Is there any scenario in which dev->fw_buf.virt is null and > s5p_mfc_load_firmware is called? > I suspect this check is not necessary at all. > I don't believe so. Allocation is done in s5p_mfc_configure_dma_memory() code path and if that fails it bails out of _probe. I can remove the check all together. thanks, -- Shuah From 1582941318195350995@xxx Thu Nov 02 08:14:39 +0000 2017 X-GM-THRID: 1580545299794355309 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread