phone-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "André Apitzsch via B4 Relay" <devnull+git.apitzsch.eu@kernel.org>
To: Sakari Ailus <sakari.ailus@linux.intel.com>,
	 Ricardo Ribalda <ribalda@kernel.org>,
	 Mauro Carvalho Chehab <mchehab@kernel.org>,
	 Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	 Markus Elfring <Markus.Elfring@web.de>
Cc: ~postmarketos/upstreaming@lists.sr.ht,
	phone-devel@vger.kernel.org, linux-media@vger.kernel.org,
	linux-kernel@vger.kernel.org, "André Apitzsch" <git@apitzsch.eu>
Subject: [PATCH v2 3/5] media: i2c: imx214: Use __free(fwnode_handle)
Date: Mon, 30 Jun 2025 21:05:23 +0200	[thread overview]
Message-ID: <20250630-imx214_fixes-v2-3-cd1a76c412c0@apitzsch.eu> (raw)
In-Reply-To: <20250630-imx214_fixes-v2-0-cd1a76c412c0@apitzsch.eu>

From: André Apitzsch <git@apitzsch.eu>

Use the __free(fwnode_handle) hook to free the endpoint when the
function exits to simplify the error path.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: André Apitzsch <git@apitzsch.eu>
---
 drivers/media/i2c/imx214.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/media/i2c/imx214.c b/drivers/media/i2c/imx214.c
index d9193bafa3cbb8fec2679200c38d30077d1b11bd..b84197ee5177d609b1395e14e1404ffa5b9a6dbf 100644
--- a/drivers/media/i2c/imx214.c
+++ b/drivers/media/i2c/imx214.c
@@ -1326,8 +1326,8 @@ static int imx214_identify_module(struct imx214 *imx214)
 
 static int imx214_parse_fwnode(struct imx214 *imx214)
 {
+	struct fwnode_handle *endpoint __free(fwnode_handle) = NULL;
 	struct v4l2_fwnode_endpoint *bus_cfg = &imx214->bus_cfg;
-	struct fwnode_handle *endpoint;
 	struct device *dev = imx214->dev;
 	unsigned int i;
 	int ret;
@@ -1338,11 +1338,8 @@ static int imx214_parse_fwnode(struct imx214 *imx214)
 
 	bus_cfg->bus_type = V4L2_MBUS_CSI2_DPHY;
 	ret = v4l2_fwnode_endpoint_alloc_parse(endpoint, bus_cfg);
-	fwnode_handle_put(endpoint);
-	if (ret) {
-		dev_err_probe(dev, ret, "parsing endpoint node failed\n");
-		goto error;
-	}
+	if (ret)
+		return dev_err_probe(dev, ret, "parsing endpoint node failed\n");
 
 	/* Check the number of MIPI CSI2 data lanes */
 	if (bus_cfg->bus.mipi_csi2.num_data_lanes != 4) {

-- 
2.50.0



  parent reply	other threads:[~2025-06-30 19:07 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-30 19:05 [PATCH v2 0/5] media: i2c: imx214: Add some style improvements André Apitzsch via B4 Relay
2025-06-30 19:05 ` [PATCH v2 1/5] media: i2c: imx214: Remove unneeded parentheses André Apitzsch via B4 Relay
2025-06-30 19:05 ` [PATCH v2 2/5] media: i2c: imx214: Drop dev argument from imx214_parse_fwnode() André Apitzsch via B4 Relay
2025-06-30 19:05 ` André Apitzsch via B4 Relay [this message]
2025-06-30 19:05 ` [PATCH v2 4/5] media: i2c: imx214: Move imx214_pll_update to imx214_ctrls_init André Apitzsch via B4 Relay
2025-06-30 19:05 ` [PATCH v2 5/5] media: i2c: imx214: Separate legacy link frequency check from PLL calculation André Apitzsch via B4 Relay
2025-07-01  9:18 ` [v2 0/5] media: i2c: imx214: Add some style improvements Markus Elfring
2025-08-10 21:48 ` [PATCH v2 " André Apitzsch
2025-08-11 11:03   ` Sakari Ailus

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=20250630-imx214_fixes-v2-3-cd1a76c412c0@apitzsch.eu \
    --to=devnull+git.apitzsch.eu@kernel.org \
    --cc=Markus.Elfring@web.de \
    --cc=git@apitzsch.eu \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=phone-devel@vger.kernel.org \
    --cc=ribalda@kernel.org \
    --cc=sakari.ailus@linux.intel.com \
    --cc=~postmarketos/upstreaming@lists.sr.ht \
    /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).