linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Helen Koike <helen.koike@collabora.com>
To: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>,
	linux-media@vger.kernel.org
Cc: ezequiel@collabora.com, andre.almeida@collabora.com,
	skhan@linuxfoundation.org, hverkuil@xs4all.nl,
	kernel@collabora.com, dafna3@gmail.com
Subject: Re: [PATCH v2 2/5] media: vimc: cleanup code that assigns entity in entities array
Date: Thu, 3 Oct 2019 10:52:32 -0300	[thread overview]
Message-ID: <4ca9ae4c-2988-1b48-23d7-047541ed7bc4@collabora.com> (raw)
In-Reply-To: <20191003104409.15756-3-dafna.hirschfeld@collabora.com>



On 10/3/19 7:44 AM, Dafna Hirschfeld wrote:
> Since the add callback returns NULL on failure and the array
> is initialized to NULLs, there is no need for the intermediate
> assignment to local var.
> 
> Signed-off-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>

I would just rename the title to something like:
"media: vimc: remove unnecessary var when adding entities"

It makes clear what you are doing and where, what do you think?

With this:

Acked-by: Helen Koike <helen.koike@collabora.com>

> ---
>  drivers/media/platform/vimc/vimc-core.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/media/platform/vimc/vimc-core.c b/drivers/media/platform/vimc/vimc-core.c
> index b8add4087652..325f55d0d8b3 100644
> --- a/drivers/media/platform/vimc/vimc-core.c
> +++ b/drivers/media/platform/vimc/vimc-core.c
> @@ -160,19 +160,17 @@ static int vimc_create_links(struct vimc_device *vimc)
>  static int vimc_add_subdevs(struct vimc_device *vimc)
>  {
>  	unsigned int i;
> -	struct vimc_ent_device *ved;
>  
>  	for (i = 0; i < vimc->pipe_cfg->num_ents; i++) {
>  		dev_dbg(&vimc->pdev.dev, "new entity for %s\n",
>  			vimc->pipe_cfg->ents[i].name);
> -		ved = vimc->pipe_cfg->ents[i].add(vimc,
> +		vimc->ent_devs[i] = vimc->pipe_cfg->ents[i].add(vimc,
>  					vimc->pipe_cfg->ents[i].name);
> -		if (!ved) {
> +		if (!vimc->ent_devs[i]) {
>  			dev_err(&vimc->pdev.dev, "add new entity for %s\n",
>  				vimc->pipe_cfg->ents[i].name);
>  			return -EINVAL;
>  		}
> -		vimc->ent_devs[i] = ved;
>  	}
>  	return 0;
>  }
> 

  reply	other threads:[~2019-10-03 13:52 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-03 10:44 [PATCH v2 0/5] media: vimc: bug fixes related to memory management Dafna Hirschfeld
2019-10-03 10:44 ` [PATCH v2 1/5] media: vimc: initialize vim entity pointers to NULL Dafna Hirschfeld
2019-10-03 13:33   ` Helen Koike
2019-10-03 10:44 ` [PATCH v2 2/5] media: vimc: cleanup code that assigns entity in entities array Dafna Hirschfeld
2019-10-03 13:52   ` Helen Koike [this message]
2019-10-03 10:44 ` [PATCH v2 3/5] media: vimc: sensor: register subdevice only after initialization Dafna Hirschfeld
2019-10-03 15:14   ` Helen Koike
2019-10-03 10:44 ` [PATCH v2 4/5] media: vimc: move media_entity_cleanup to release callbacks Dafna Hirschfeld
2019-10-03 10:44 ` [PATCH v2 5/5] media: vimc: remove the helper function vimc_ent_sd_unregister Dafna Hirschfeld
2019-10-03 15:17   ` Helen Koike

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=4ca9ae4c-2988-1b48-23d7-047541ed7bc4@collabora.com \
    --to=helen.koike@collabora.com \
    --cc=andre.almeida@collabora.com \
    --cc=dafna.hirschfeld@collabora.com \
    --cc=dafna3@gmail.com \
    --cc=ezequiel@collabora.com \
    --cc=hverkuil@xs4all.nl \
    --cc=kernel@collabora.com \
    --cc=linux-media@vger.kernel.org \
    --cc=skhan@linuxfoundation.org \
    /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;
as well as URLs for NNTP newsgroup(s).