From: Andrzej Hajda <a.hajda@samsung.com>
To: Shuah Khan <shuahkh@osg.samsung.com>,
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
Subject: Re: [PATCH 1/2] media: s5p-mfc: check for firmware allocation before requesting firmware
Date: Thu, 02 Nov 2017 09:12:43 +0100 [thread overview]
Message-ID: <5bbc048a-4b68-de23-373d-eb8a12c5b736@samsung.com> (raw)
In-Reply-To: <e7c1ad0167ca363cc783be11871a04957127a3fa.1507325072.git.shuahkh@osg.samsung.com>
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 <shuahkh@osg.samsung.com>
> ---
> 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.
Regards
Andrzej
> memcpy(dev->fw_buf.virt, fw_blob->data, fw_blob->size);
> wmb();
> release_firmware(fw_blob);
next prev parent reply other threads:[~2017-11-02 8:13 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-06 21:30 [PATCH 0/2] Fix s5p-mfc lock contention in request firmware paths Shuah Khan
2017-10-06 21:30 ` [PATCH 1/2] media: s5p-mfc: check for firmware allocation before requesting firmware Shuah Khan
2017-11-02 8:12 ` Andrzej Hajda [this message]
2017-11-03 0:23 ` Shuah Khan
2017-10-06 21:30 ` [PATCH 2/2] media: s5p-mfc: fix lock confection - request_firmware() once and keep state Shuah Khan
2017-11-02 8:31 ` Andrzej Hajda
2017-11-03 0:27 ` Shuah Khan
2017-11-03 0:43 ` Marian Mihailescu
2017-11-03 14:09 ` Shuah Khan
2017-10-25 21:24 ` [PATCH 0/2] Fix s5p-mfc lock contention in request firmware paths Shuah Khan
2017-10-25 22:28 ` Marian Mihailescu
2017-10-26 6:53 ` Shuah Khan
2017-10-30 21:51 ` Shuah Khan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5bbc048a-4b68-de23-373d-eb8a12c5b736@samsung.com \
--to=a.hajda@samsung.com \
--cc=jtp.park@samsung.com \
--cc=kamil@wypas.org \
--cc=kyungmin.park@samsung.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=shuahkh@osg.samsung.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®