Linux-Media Archive mirror
 help / color / mirror / Atom feed
From: Abdulrasaq Lawani <abdulrasaqolawani@gmail.com>
To: akari.ailus@linux.intel.com, dave.stevenson@raspberrypi.com,
	jacopo@jmondi.org, mchehab@kernel.org,
	linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
	julia.lawall@inria.fr
Cc: Abdulrasaq Lawani <abdulrasaqolawani@gmail.com>,
	skhan@linuxfoundation.org, javier.carrasco.cruz@gmail.com
Subject: [PATCH] media: i2c: replacing of_node_put with __free(device_node)
Date: Wed,  8 May 2024 01:42:53 -0400	[thread overview]
Message-ID: <20240508054253.1568781-1-abdulrasaqolawani@gmail.com> (raw)

Replaced instance of of_node_put with __free(device_node)
and removed goto statement to protect against any memory leaks
due to future changes in control flow.

Suggested-by: Julia Lawall <julia.lawall@inria.fr>
Signed-off-by: Abdulrasaq Lawani <abdulrasaqolawani@gmail.com>
---
 drivers/media/i2c/ov5647.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/media/i2c/ov5647.c b/drivers/media/i2c/ov5647.c
index 7e1ecdf2485f..d593dba092e3 100644
--- a/drivers/media/i2c/ov5647.c
+++ b/drivers/media/i2c/ov5647.c
@@ -1360,23 +1360,19 @@ static int ov5647_parse_dt(struct ov5647 *sensor, struct device_node *np)
 	struct v4l2_fwnode_endpoint bus_cfg = {
 		.bus_type = V4L2_MBUS_CSI2_DPHY,
 	};
-	struct device_node *ep;
+	struct device_node *ep __free(device_node) = of_graph_get_endpoint_by_regs(np, 0, -1);
 	int ret;
 
-	ep = of_graph_get_endpoint_by_regs(np, 0, -1);
 	if (!ep)
 		return -EINVAL;
 
 	ret = v4l2_fwnode_endpoint_parse(of_fwnode_handle(ep), &bus_cfg);
 	if (ret)
-		goto out;
+		return ret;
 
 	sensor->clock_ncont = bus_cfg.bus.mipi_csi2.flags &
 			      V4L2_MBUS_CSI2_NONCONTINUOUS_CLOCK;
 
-out:
-	of_node_put(ep);
-
 	return ret;
 }
 
-- 
2.34.1


             reply	other threads:[~2024-05-08  5:42 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-08  5:42 Abdulrasaq Lawani [this message]
2024-05-08  6:28 ` [PATCH] media: i2c: replacing of_node_put with __free(device_node) Julia Lawall
  -- strict thread matches above, loose matches on Subject: below --
2024-05-10 10:03 Abdulrasaq Lawani

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=20240508054253.1568781-1-abdulrasaqolawani@gmail.com \
    --to=abdulrasaqolawani@gmail.com \
    --cc=akari.ailus@linux.intel.com \
    --cc=dave.stevenson@raspberrypi.com \
    --cc=jacopo@jmondi.org \
    --cc=javier.carrasco.cruz@gmail.com \
    --cc=julia.lawall@inria.fr \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@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 read-only IMAP folder(s) and NNTP newsgroup(s).