All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] media: stm32-dcmi: simplify of_node_put usage
@ 2018-06-12 17:23 ` Nicholas Mc Guire
  0 siblings, 0 replies; 7+ messages in thread
From: Nicholas Mc Guire @ 2018-06-12 17:23 UTC (permalink / raw)
  To: Mauro Carvalho Chehab
  Cc: Maxime Coquelin, Alexandre Torgue, Hans Verkuil, Hugues Fruchet,
	Philipp Zabel, Niklas Soderlund, Benjamin Gaignard,
	Gustavo A. R. Silva, linux-media, linux-arm-kernel, linux-kernel,
	Nicholas Mc Guire

This does not fix any bug - this is just a code simplification. As
np is not used after passing it to v4l2_fwnode_endpoint_parse() its
refcount can be decremented immediately and at one location.

Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
---

Issue found during code reading.

Patch was compile tested with: x86_64_defconfig, MEDIA_SUPPORT=y
MEDIA_CAMERA_SUPPORT=y, V4L_PLATFORM_DRIVERS=y, OF=y, COMPILE_TEST=y
CONFIG_VIDEO_STM32_DCMI=y
(There are a few sparse warnings - but unrelated to the lines changed)

Patch is against 4.17.0 (localversion-next is next-20180608)

 drivers/media/platform/stm32/stm32-dcmi.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/media/platform/stm32/stm32-dcmi.c b/drivers/media/platform/stm32/stm32-dcmi.c
index 2e1933d..0b61042 100644
--- a/drivers/media/platform/stm32/stm32-dcmi.c
+++ b/drivers/media/platform/stm32/stm32-dcmi.c
@@ -1696,23 +1696,20 @@ static int dcmi_probe(struct platform_device *pdev)
 	}
 
 	ret = v4l2_fwnode_endpoint_parse(of_fwnode_handle(np), &ep);
+	of_node_put(np);
 	if (ret) {
 		dev_err(&pdev->dev, "Could not parse the endpoint\n");
-		of_node_put(np);
 		return -ENODEV;
 	}
 
 	if (ep.bus_type == V4L2_MBUS_CSI2) {
 		dev_err(&pdev->dev, "CSI bus not supported\n");
-		of_node_put(np);
 		return -ENODEV;
 	}
 	dcmi->bus.flags = ep.bus.parallel.flags;
 	dcmi->bus.bus_width = ep.bus.parallel.bus_width;
 	dcmi->bus.data_shift = ep.bus.parallel.data_shift;
 
-	of_node_put(np);
-
 	irq = platform_get_irq(pdev, 0);
 	if (irq <= 0) {
 		dev_err(&pdev->dev, "Could not get irq\n");
-- 
2.1.4


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

* [PATCH] media: stm32-dcmi: simplify of_node_put usage
@ 2018-06-12 17:23 ` Nicholas Mc Guire
  0 siblings, 0 replies; 7+ messages in thread
From: Nicholas Mc Guire @ 2018-06-12 17:23 UTC (permalink / raw)
  To: linux-arm-kernel

This does not fix any bug - this is just a code simplification. As
np is not used after passing it to v4l2_fwnode_endpoint_parse() its
refcount can be decremented immediately and at one location.

Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
---

Issue found during code reading.

Patch was compile tested with: x86_64_defconfig, MEDIA_SUPPORT=y
MEDIA_CAMERA_SUPPORT=y, V4L_PLATFORM_DRIVERS=y, OF=y, COMPILE_TEST=y
CONFIG_VIDEO_STM32_DCMI=y
(There are a few sparse warnings - but unrelated to the lines changed)

Patch is against 4.17.0 (localversion-next is next-20180608)

 drivers/media/platform/stm32/stm32-dcmi.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/media/platform/stm32/stm32-dcmi.c b/drivers/media/platform/stm32/stm32-dcmi.c
index 2e1933d..0b61042 100644
--- a/drivers/media/platform/stm32/stm32-dcmi.c
+++ b/drivers/media/platform/stm32/stm32-dcmi.c
@@ -1696,23 +1696,20 @@ static int dcmi_probe(struct platform_device *pdev)
 	}
 
 	ret = v4l2_fwnode_endpoint_parse(of_fwnode_handle(np), &ep);
+	of_node_put(np);
 	if (ret) {
 		dev_err(&pdev->dev, "Could not parse the endpoint\n");
-		of_node_put(np);
 		return -ENODEV;
 	}
 
 	if (ep.bus_type == V4L2_MBUS_CSI2) {
 		dev_err(&pdev->dev, "CSI bus not supported\n");
-		of_node_put(np);
 		return -ENODEV;
 	}
 	dcmi->bus.flags = ep.bus.parallel.flags;
 	dcmi->bus.bus_width = ep.bus.parallel.bus_width;
 	dcmi->bus.data_shift = ep.bus.parallel.data_shift;
 
-	of_node_put(np);
-
 	irq = platform_get_irq(pdev, 0);
 	if (irq <= 0) {
 		dev_err(&pdev->dev, "Could not get irq\n");
-- 
2.1.4

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

* Re: [PATCH] media: stm32-dcmi: simplify of_node_put usage
  2018-06-12 17:23 ` Nicholas Mc Guire
  (?)
@ 2018-06-18  9:36   ` Hugues FRUCHET
  -1 siblings, 0 replies; 7+ messages in thread
From: Hugues FRUCHET @ 2018-06-18  9:36 UTC (permalink / raw)
  To: Nicholas Mc Guire, Mauro Carvalho Chehab
  Cc: Maxime Coquelin, Alexandre TORGUE, Hans Verkuil, Philipp Zabel,
	Niklas Soderlund, Benjamin Gaignard, Gustavo A. R. Silva,
	linux-media, linux-arm-kernel, linux-kernel

Hi Nicholas,
Thanks for patch,

On 06/12/2018 07:23 PM, Nicholas Mc Guire wrote:
> This does not fix any bug - this is just a code simplification. As
> np is not used after passing it to v4l2_fwnode_endpoint_parse() its
> refcount can be decremented immediately and at one location.
> 
> Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
Acked-by: Hugues Fruchet <hugues.fruchet@st.com>

> ---
> 
> Issue found during code reading.
> 
> Patch was compile tested with: x86_64_defconfig, MEDIA_SUPPORT=y
> MEDIA_CAMERA_SUPPORT=y, V4L_PLATFORM_DRIVERS=y, OF=y, COMPILE_TEST=y
> CONFIG_VIDEO_STM32_DCMI=y
> (There are a few sparse warnings - but unrelated to the lines changed)
> 
> Patch is against 4.17.0 (localversion-next is next-20180608)
> 
>   drivers/media/platform/stm32/stm32-dcmi.c | 5 +----
>   1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/drivers/media/platform/stm32/stm32-dcmi.c b/drivers/media/platform/stm32/stm32-dcmi.c
> index 2e1933d..0b61042 100644
> --- a/drivers/media/platform/stm32/stm32-dcmi.c
> +++ b/drivers/media/platform/stm32/stm32-dcmi.c
> @@ -1696,23 +1696,20 @@ static int dcmi_probe(struct platform_device *pdev)
>   	}
>   
>   	ret = v4l2_fwnode_endpoint_parse(of_fwnode_handle(np), &ep);
> +	of_node_put(np);
>   	if (ret) {
>   		dev_err(&pdev->dev, "Could not parse the endpoint\n");
> -		of_node_put(np);
>   		return -ENODEV;
>   	}
>   
>   	if (ep.bus_type == V4L2_MBUS_CSI2) {
>   		dev_err(&pdev->dev, "CSI bus not supported\n");
> -		of_node_put(np);
>   		return -ENODEV;
>   	}
>   	dcmi->bus.flags = ep.bus.parallel.flags;
>   	dcmi->bus.bus_width = ep.bus.parallel.bus_width;
>   	dcmi->bus.data_shift = ep.bus.parallel.data_shift;
>   
> -	of_node_put(np);
> -
>   	irq = platform_get_irq(pdev, 0);
>   	if (irq <= 0) {
>   		dev_err(&pdev->dev, "Could not get irq\n");
> 

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

* Re: [PATCH] media: stm32-dcmi: simplify of_node_put usage
@ 2018-06-18  9:36   ` Hugues FRUCHET
  0 siblings, 0 replies; 7+ messages in thread
From: Hugues FRUCHET @ 2018-06-18  9:36 UTC (permalink / raw)
  To: Nicholas Mc Guire, Mauro Carvalho Chehab
  Cc: Maxime Coquelin, Alexandre TORGUE, Hans Verkuil, Philipp Zabel,
	Niklas Soderlund, Benjamin Gaignard, Gustavo A. R. Silva,
	linux-media, linux-arm-kernel, linux-kernel

Hi Nicholas,
Thanks for patch,

On 06/12/2018 07:23 PM, Nicholas Mc Guire wrote:
> This does not fix any bug - this is just a code simplification. As
> np is not used after passing it to v4l2_fwnode_endpoint_parse() its
> refcount can be decremented immediately and at one location.
> 
> Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
Acked-by: Hugues Fruchet <hugues.fruchet@st.com>

> ---
> 
> Issue found during code reading.
> 
> Patch was compile tested with: x86_64_defconfig, MEDIA_SUPPORT=y
> MEDIA_CAMERA_SUPPORT=y, V4L_PLATFORM_DRIVERS=y, OF=y, COMPILE_TEST=y
> CONFIG_VIDEO_STM32_DCMI=y
> (There are a few sparse warnings - but unrelated to the lines changed)
> 
> Patch is against 4.17.0 (localversion-next is next-20180608)
> 
>   drivers/media/platform/stm32/stm32-dcmi.c | 5 +----
>   1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/drivers/media/platform/stm32/stm32-dcmi.c b/drivers/media/platform/stm32/stm32-dcmi.c
> index 2e1933d..0b61042 100644
> --- a/drivers/media/platform/stm32/stm32-dcmi.c
> +++ b/drivers/media/platform/stm32/stm32-dcmi.c
> @@ -1696,23 +1696,20 @@ static int dcmi_probe(struct platform_device *pdev)
>   	}
>   
>   	ret = v4l2_fwnode_endpoint_parse(of_fwnode_handle(np), &ep);
> +	of_node_put(np);
>   	if (ret) {
>   		dev_err(&pdev->dev, "Could not parse the endpoint\n");
> -		of_node_put(np);
>   		return -ENODEV;
>   	}
>   
>   	if (ep.bus_type == V4L2_MBUS_CSI2) {
>   		dev_err(&pdev->dev, "CSI bus not supported\n");
> -		of_node_put(np);
>   		return -ENODEV;
>   	}
>   	dcmi->bus.flags = ep.bus.parallel.flags;
>   	dcmi->bus.bus_width = ep.bus.parallel.bus_width;
>   	dcmi->bus.data_shift = ep.bus.parallel.data_shift;
>   
> -	of_node_put(np);
> -
>   	irq = platform_get_irq(pdev, 0);
>   	if (irq <= 0) {
>   		dev_err(&pdev->dev, "Could not get irq\n");
> 

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

* [PATCH] media: stm32-dcmi: simplify of_node_put usage
@ 2018-06-18  9:36   ` Hugues FRUCHET
  0 siblings, 0 replies; 7+ messages in thread
From: Hugues FRUCHET @ 2018-06-18  9:36 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Nicholas,
Thanks for patch,

On 06/12/2018 07:23 PM, Nicholas Mc Guire wrote:
> This does not fix any bug - this is just a code simplification. As
> np is not used after passing it to v4l2_fwnode_endpoint_parse() its
> refcount can be decremented immediately and at one location.
> 
> Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
Acked-by: Hugues Fruchet <hugues.fruchet@st.com>

> ---
> 
> Issue found during code reading.
> 
> Patch was compile tested with: x86_64_defconfig, MEDIA_SUPPORT=y
> MEDIA_CAMERA_SUPPORT=y, V4L_PLATFORM_DRIVERS=y, OF=y, COMPILE_TEST=y
> CONFIG_VIDEO_STM32_DCMI=y
> (There are a few sparse warnings - but unrelated to the lines changed)
> 
> Patch is against 4.17.0 (localversion-next is next-20180608)
> 
>   drivers/media/platform/stm32/stm32-dcmi.c | 5 +----
>   1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/drivers/media/platform/stm32/stm32-dcmi.c b/drivers/media/platform/stm32/stm32-dcmi.c
> index 2e1933d..0b61042 100644
> --- a/drivers/media/platform/stm32/stm32-dcmi.c
> +++ b/drivers/media/platform/stm32/stm32-dcmi.c
> @@ -1696,23 +1696,20 @@ static int dcmi_probe(struct platform_device *pdev)
>   	}
>   
>   	ret = v4l2_fwnode_endpoint_parse(of_fwnode_handle(np), &ep);
> +	of_node_put(np);
>   	if (ret) {
>   		dev_err(&pdev->dev, "Could not parse the endpoint\n");
> -		of_node_put(np);
>   		return -ENODEV;
>   	}
>   
>   	if (ep.bus_type == V4L2_MBUS_CSI2) {
>   		dev_err(&pdev->dev, "CSI bus not supported\n");
> -		of_node_put(np);
>   		return -ENODEV;
>   	}
>   	dcmi->bus.flags = ep.bus.parallel.flags;
>   	dcmi->bus.bus_width = ep.bus.parallel.bus_width;
>   	dcmi->bus.data_shift = ep.bus.parallel.data_shift;
>   
> -	of_node_put(np);
> -
>   	irq = platform_get_irq(pdev, 0);
>   	if (irq <= 0) {
>   		dev_err(&pdev->dev, "Could not get irq\n");
> 

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

* [PATCH] media: stm32-dcmi: simplify of_node_put usage
@ 2018-06-10 15:23 ` Nicholas Mc Guire
  0 siblings, 0 replies; 7+ messages in thread
From: Nicholas Mc Guire @ 2018-06-10 15:23 UTC (permalink / raw)
  To: Mauro Carvalho Chehab
  Cc: Maxime Coquelin, Alexandre Torgue, Hans Verkuil, Hugues Fruchet,
	Philipp Zabel, Niklas Soderlund, Benjamin Gaignard,
	Gustavo A. R. Silva, linux-media, linux-arm-kernel, linux-kernel,
	Nicholas Mc Guire

This does not fix any bug - this is just a code simplification. As
np is not used after passing it to v4l2_fwnode_endpoint_parse() its
refcount can be decremented immediately and at one location.

Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
---

Issue found during code reading.

Patch was compile tested with: x86_64_defconfig, MEDIA_SUPPORT=y
MEDIA_CAMERA_SUPPORT=y, V4L_PLATFORM_DRIVERS=y, OF=y, COMPILE_TEST=y
CONFIG_VIDEO_STM32_DCMI=y
(There are a few sparse warnings - but unrelated to the lines changed)

Patch is against 4.17.0 (localversion-next is next-20180608)

 drivers/media/platform/stm32/stm32-dcmi.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/media/platform/stm32/stm32-dcmi.c b/drivers/media/platform/stm32/stm32-dcmi.c
index 2e1933d..0b61042 100644
--- a/drivers/media/platform/stm32/stm32-dcmi.c
+++ b/drivers/media/platform/stm32/stm32-dcmi.c
@@ -1696,23 +1696,20 @@ static int dcmi_probe(struct platform_device *pdev)
 	}
 
 	ret = v4l2_fwnode_endpoint_parse(of_fwnode_handle(np), &ep);
+	of_node_put(np);
 	if (ret) {
 		dev_err(&pdev->dev, "Could not parse the endpoint\n");
-		of_node_put(np);
 		return -ENODEV;
 	}
 
 	if (ep.bus_type == V4L2_MBUS_CSI2) {
 		dev_err(&pdev->dev, "CSI bus not supported\n");
-		of_node_put(np);
 		return -ENODEV;
 	}
 	dcmi->bus.flags = ep.bus.parallel.flags;
 	dcmi->bus.bus_width = ep.bus.parallel.bus_width;
 	dcmi->bus.data_shift = ep.bus.parallel.data_shift;
 
-	of_node_put(np);
-
 	irq = platform_get_irq(pdev, 0);
 	if (irq <= 0) {
 		dev_err(&pdev->dev, "Could not get irq\n");
-- 
2.1.4

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

* [PATCH] media: stm32-dcmi: simplify of_node_put usage
@ 2018-06-10 15:23 ` Nicholas Mc Guire
  0 siblings, 0 replies; 7+ messages in thread
From: Nicholas Mc Guire @ 2018-06-10 15:23 UTC (permalink / raw)
  To: linux-arm-kernel

This does not fix any bug - this is just a code simplification. As
np is not used after passing it to v4l2_fwnode_endpoint_parse() its
refcount can be decremented immediately and at one location.

Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
---

Issue found during code reading.

Patch was compile tested with: x86_64_defconfig, MEDIA_SUPPORT=y
MEDIA_CAMERA_SUPPORT=y, V4L_PLATFORM_DRIVERS=y, OF=y, COMPILE_TEST=y
CONFIG_VIDEO_STM32_DCMI=y
(There are a few sparse warnings - but unrelated to the lines changed)

Patch is against 4.17.0 (localversion-next is next-20180608)

 drivers/media/platform/stm32/stm32-dcmi.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/media/platform/stm32/stm32-dcmi.c b/drivers/media/platform/stm32/stm32-dcmi.c
index 2e1933d..0b61042 100644
--- a/drivers/media/platform/stm32/stm32-dcmi.c
+++ b/drivers/media/platform/stm32/stm32-dcmi.c
@@ -1696,23 +1696,20 @@ static int dcmi_probe(struct platform_device *pdev)
 	}
 
 	ret = v4l2_fwnode_endpoint_parse(of_fwnode_handle(np), &ep);
+	of_node_put(np);
 	if (ret) {
 		dev_err(&pdev->dev, "Could not parse the endpoint\n");
-		of_node_put(np);
 		return -ENODEV;
 	}
 
 	if (ep.bus_type == V4L2_MBUS_CSI2) {
 		dev_err(&pdev->dev, "CSI bus not supported\n");
-		of_node_put(np);
 		return -ENODEV;
 	}
 	dcmi->bus.flags = ep.bus.parallel.flags;
 	dcmi->bus.bus_width = ep.bus.parallel.bus_width;
 	dcmi->bus.data_shift = ep.bus.parallel.data_shift;
 
-	of_node_put(np);
-
 	irq = platform_get_irq(pdev, 0);
 	if (irq <= 0) {
 		dev_err(&pdev->dev, "Could not get irq\n");
-- 
2.1.4

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

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

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-12 17:23 [PATCH] media: stm32-dcmi: simplify of_node_put usage Nicholas Mc Guire
2018-06-12 17:23 ` Nicholas Mc Guire
2018-06-18  9:36 ` Hugues FRUCHET
2018-06-18  9:36   ` Hugues FRUCHET
2018-06-18  9:36   ` Hugues FRUCHET
  -- strict thread matches above, loose matches on Subject: below --
2018-06-10 15:23 Nicholas Mc Guire
2018-06-10 15:23 ` Nicholas Mc Guire

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.