linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] media: adv7604: simplify of_node_put()
@ 2018-06-01  9:21 Nicholas Mc Guire
  0 siblings, 0 replies; 2+ messages in thread
From: Nicholas Mc Guire @ 2018-06-01  9:21 UTC (permalink / raw)
  To: Hans Verkuil
  Cc: Mauro Carvalho Chehab, linux-media, linux-kernel, Nicholas Mc Guire

As the of_node_put() is unconditional here there is no need to have it
twice.

Signed-off-by: Nicholas Mc Guire <hofrat@opentech.at>
---

Problem located by experimental coccinelle script

Not sure if such a change makes this much more readable - it is a trivial
simplification of the code though. Pleas let me know if such micro
refactoring makes sense or not.

Patch was compile tested with: x86_64_defconfig + GPIOLIB=y,
Multimedia support=y, CONFIG_MEDIA_DIGITAL_TV_SUPPORT=y,
CONFIG_MEDIA_CAMERA_SUPPORT=y CONFIG_VIDEO_V4L2_SUBDEV_API=y,
CONFIG_VIDEO_ADV7604=y

Patch is against 4.17-rc5 (localversion-next is -next-20180529)

 drivers/media/i2c/adv7604.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
index cac2081..cc8eac3 100644
--- a/drivers/media/i2c/adv7604.c
+++ b/drivers/media/i2c/adv7604.c
@@ -3108,12 +3108,9 @@ static int adv76xx_parse_dt(struct adv76xx_state *state)
 		return -EINVAL;
 
 	ret = v4l2_fwnode_endpoint_parse(of_fwnode_handle(endpoint), &bus_cfg);
-	if (ret) {
-		of_node_put(endpoint);
-		return ret;
-	}
-
 	of_node_put(endpoint);
+	if (ret)
+		return ret;
 
 	if (!of_property_read_u32(np, "default-input", &v))
 		state->pdata.default_input = v;
-- 
2.1.4

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

* [PATCH] media: adv7604: simplify of_node_put()
@ 2018-05-30 10:55 Nicholas Mc Guire
  0 siblings, 0 replies; 2+ messages in thread
From: Nicholas Mc Guire @ 2018-05-30 10:55 UTC (permalink / raw)
  To: Hans Verkuil
  Cc: Mauro Carvalho Chehab, linux-media, linux-kernel, Nicholas Mc Guire

From: Nicholas Mc Guire <hofrat@opentech.at>

As the of_node_put() is unconditional here there is no need to have it
twice.

Signed-off-by: Nicholas Mc Guire <hofrat@opentech.at>
---

Problem located by experimental coccinelle script

Not sure if such a change makes this much more readable - it is a trivial
simplification of the code though. Pleas let me know if such micro
refactoring makes sense or not.

Patch was compile tested with: x86_64_defconfig + GPIOLIB=y,
Multimedia support=y, CONFIG_MEDIA_DIGITAL_TV_SUPPORT=y,
CONFIG_MEDIA_CAMERA_SUPPORT=y CONFIG_VIDEO_V4L2_SUBDEV_API=y,
CONFIG_VIDEO_ADV7604=y

Patch is against 4.17-rc5 (localversion-next is -next-20180529)

 drivers/media/i2c/adv7604.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
index cac2081..cc8eac3 100644
--- a/drivers/media/i2c/adv7604.c
+++ b/drivers/media/i2c/adv7604.c
@@ -3108,12 +3108,9 @@ static int adv76xx_parse_dt(struct adv76xx_state *state)
 		return -EINVAL;
 
 	ret = v4l2_fwnode_endpoint_parse(of_fwnode_handle(endpoint), &bus_cfg);
-	if (ret) {
-		of_node_put(endpoint);
-		return ret;
-	}
-
 	of_node_put(endpoint);
+	if (ret)
+		return ret;
 
 	if (!of_property_read_u32(np, "default-input", &v))
 		state->pdata.default_input = v;
-- 
2.1.4

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

end of thread, other threads:[~2018-06-01  9:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-01  9:21 [PATCH] media: adv7604: simplify of_node_put() Nicholas Mc Guire
  -- strict thread matches above, loose matches on Subject: below --
2018-05-30 10:55 Nicholas Mc Guire

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).