Linux Media Controller development
 help / color / mirror / Atom feed
From: "Niklas Söderlund" <niklas.soderlund@ragnatech.se>
To: Jacopo Mondi <jacopo+renesas@jmondi.org>
Cc: laurent.pinchart@ideasonboard.com, mchehab@kernel.org,
	linux-media@vger.kernel.org, linux-renesas-soc@vger.kernel.org
Subject: Re: [PATCH v5 04/10] media: rcar-vin: Cleanup notifier in error path
Date: Mon, 4 Jun 2018 14:43:05 +0200	[thread overview]
Message-ID: <20180604124305.GJ19674@bigcity.dyn.berto.se> (raw)
In-Reply-To: <1527583688-314-5-git-send-email-jacopo+renesas@jmondi.org>

Hi Jacopo,

Thanks for your work.

On 2018-05-29 10:48:02 +0200, Jacopo Mondi wrote:
> During the notifier initialization, memory for the list of associated async
> subdevices is reserved during the fwnode endpoint parsing from the v4l2-async
> framework. If the notifier registration fails, that memory should be released
> and the notifier 'cleaned up'.
> 
> Catch the notifier registration error and perform the cleanup both for the
> group and the parallel notifiers.
> 
> Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>

I agree with Kieran's review comment that it's better to call 
v4l2_async_notifier_cleanup() directly instead of adding a goto. With 
that fixed feel free to add

Acked-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>

> 
> ---
> v5:
> - new patch
> 
> ---
>  drivers/media/platform/rcar-vin/rcar-core.c | 14 ++++++++++++--
>  1 file changed, 12 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/media/platform/rcar-vin/rcar-core.c b/drivers/media/platform/rcar-vin/rcar-core.c
> index d3aadf3..f7a28e9 100644
> --- a/drivers/media/platform/rcar-vin/rcar-core.c
> +++ b/drivers/media/platform/rcar-vin/rcar-core.c
> @@ -573,10 +573,15 @@ static int rvin_parallel_graph_init(struct rvin_dev *vin)
>  	ret = v4l2_async_notifier_register(&vin->v4l2_dev, &vin->notifier);
>  	if (ret < 0) {
>  		vin_err(vin, "Notifier registration failed\n");
> -		return ret;
> +		goto error_notifier_cleanup;
>  	}
> 
>  	return 0;
> +
> +error_notifier_cleanup:
> +	v4l2_async_notifier_cleanup(&vin->group->notifier);
> +
> +	return ret;
>  }
> 
>  /* -----------------------------------------------------------------------------
> @@ -775,10 +780,15 @@ static int rvin_mc_parse_of_graph(struct rvin_dev *vin)
>  					   &vin->group->notifier);
>  	if (ret < 0) {
>  		vin_err(vin, "Notifier registration failed\n");
> -		return ret;
> +		goto error_notifier_cleanup;
>  	}
> 
>  	return 0;
> +
> +error_notifier_cleanup:
> +	v4l2_async_notifier_cleanup(&vin->group->notifier);
> +
> +	return ret;
>  }
> 
>  static int rvin_mc_init(struct rvin_dev *vin)
> --
> 2.7.4
> 

-- 
Regards,
Niklas Söderlund

  parent reply	other threads:[~2018-06-04 12:43 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-29  8:47 [PATCH v5 0/10] rcar-vin: Add support for parallel input on Gen3 Jacopo Mondi
2018-05-29  8:47 ` [PATCH v5 01/10] media: rcar-vin: Rename 'digital' to 'parallel' Jacopo Mondi
2018-05-29  8:48 ` [PATCH v5 02/10] media: rcar-vin: Remove two empty lines Jacopo Mondi
2018-05-29  8:48 ` [PATCH v5 03/10] media: rcar-vin: Create a group notifier Jacopo Mondi
2018-06-04 12:40   ` Niklas Söderlund
2018-05-29  8:48 ` [PATCH v5 04/10] media: rcar-vin: Cleanup notifier in error path Jacopo Mondi
2018-05-29  9:02   ` Kieran Bingham
2018-06-04 12:43   ` Niklas Söderlund [this message]
2018-05-29  8:48 ` [PATCH v5 05/10] media: rcar-vin: Cache the mbus configuration flags Jacopo Mondi
2018-06-04 12:46   ` Niklas Söderlund
2018-05-29  8:48 ` [PATCH v5 06/10] media: rcar-vin: Parse parallel input on Gen3 Jacopo Mondi
2018-05-29 12:39   ` jacopo mondi
2018-05-31 14:13   ` kbuild test robot
2018-06-04 12:52   ` Niklas Söderlund
2018-05-29  8:48 ` [PATCH v5 07/10] media: rcar-vin: Link parallel input media entities Jacopo Mondi
2018-05-29  8:48 ` [PATCH v5 08/10] media: rcar-vin: Handle parallel subdev in link_notify Jacopo Mondi
2018-05-29  8:48 ` [PATCH v5 09/10] media: rcar-vin: Rename _rcar_info to rcar_info Jacopo Mondi
2018-05-29  8:48 ` [PATCH v5 10/10] media: rcar-vin: Add support for R-Car R8A77995 SoC Jacopo Mondi

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=20180604124305.GJ19674@bigcity.dyn.berto.se \
    --to=niklas.soderlund@ragnatech.se \
    --cc=jacopo+renesas@jmondi.org \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=mchehab@kernel.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