public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] media: rzg2l-csi2: Use common error handling code in rzg2l_csi2_parse_dt()
@ 2024-03-01 13:10 Markus Elfring
  2024-03-01 13:14 ` Laurent Pinchart
  0 siblings, 1 reply; 2+ messages in thread
From: Markus Elfring @ 2024-03-01 13:10 UTC (permalink / raw)
  To: linux-media, kernel-janitors, Biju Das, Hans Verkuil,
	Lad Prabhakar, Laurent Pinchart, Mauro Carvalho Chehab,
	Sakari Ailus, Uwe Kleine-König
  Cc: LKML

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 1 Mar 2024 14:02:22 +0100

Add a label so that a bit of exception handling can be better reused
in an if branch of this function implementation.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/media/platform/renesas/rzg2l-cru/rzg2l-csi2.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-csi2.c b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-csi2.c
index e68fcdaea207..ef6922dad35f 100644
--- a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-csi2.c
+++ b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-csi2.c
@@ -671,12 +671,13 @@ static int rzg2l_csi2_parse_dt(struct rzg2l_csi2 *csi2)
 	ret = v4l2_fwnode_endpoint_parse(ep, &v4l2_ep);
 	if (ret) {
 		dev_err(csi2->dev, "Could not parse v4l2 endpoint\n");
-		fwnode_handle_put(ep);
-		return -EINVAL;
+		ret = -EINVAL;
+		goto put_fwnode_ep;
 	}

 	ret = rzg2l_csi2_parse_v4l2(csi2, &v4l2_ep);
 	if (ret) {
+put_fwnode_ep:
 		fwnode_handle_put(ep);
 		return ret;
 	}
--
2.44.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] media: rzg2l-csi2: Use common error handling code in rzg2l_csi2_parse_dt()
  2024-03-01 13:10 [PATCH] media: rzg2l-csi2: Use common error handling code in rzg2l_csi2_parse_dt() Markus Elfring
@ 2024-03-01 13:14 ` Laurent Pinchart
  0 siblings, 0 replies; 2+ messages in thread
From: Laurent Pinchart @ 2024-03-01 13:14 UTC (permalink / raw)
  To: Markus Elfring
  Cc: linux-media, kernel-janitors, Biju Das, Hans Verkuil,
	Lad Prabhakar, Mauro Carvalho Chehab, Sakari Ailus,
	Uwe Kleine-König, LKML

On Fri, Mar 01, 2024 at 02:10:41PM +0100, Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Fri, 1 Mar 2024 14:02:22 +0100
> 
> Add a label so that a bit of exception handling can be better reused
> in an if branch of this function implementation.
> 
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>

Just in case someone may be tempted to apply this:

NAK

Markus, don't bother replying to this e-mail, I will delete your reply
without reading it.

> ---
>  drivers/media/platform/renesas/rzg2l-cru/rzg2l-csi2.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-csi2.c b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-csi2.c
> index e68fcdaea207..ef6922dad35f 100644
> --- a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-csi2.c
> +++ b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-csi2.c
> @@ -671,12 +671,13 @@ static int rzg2l_csi2_parse_dt(struct rzg2l_csi2 *csi2)
>  	ret = v4l2_fwnode_endpoint_parse(ep, &v4l2_ep);
>  	if (ret) {
>  		dev_err(csi2->dev, "Could not parse v4l2 endpoint\n");
> -		fwnode_handle_put(ep);
> -		return -EINVAL;
> +		ret = -EINVAL;
> +		goto put_fwnode_ep;
>  	}
> 
>  	ret = rzg2l_csi2_parse_v4l2(csi2, &v4l2_ep);
>  	if (ret) {
> +put_fwnode_ep:
>  		fwnode_handle_put(ep);
>  		return ret;
>  	}
> --
> 2.44.0
> 
> 

-- 
Regards,

Laurent Pinchart

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-03-01 13:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-01 13:10 [PATCH] media: rzg2l-csi2: Use common error handling code in rzg2l_csi2_parse_dt() Markus Elfring
2024-03-01 13:14 ` Laurent Pinchart

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox