public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] virtio: simplify of_node handling in virtio_device_of_init
@ 2026-04-06  9:21 Clement Amar
  2026-04-06  9:26 ` Michael S. Tsirkin
  0 siblings, 1 reply; 2+ messages in thread
From: Clement Amar @ 2026-04-06  9:21 UTC (permalink / raw)
  To: Michael S . Tsirkin
  Cc: Jason Wang, Xuan Zhuo, Eugenio Pérez, virtualization,
	linux-kernel, Clement Amar

Replace goto with return for simple error

Signed-off-by: Clement Amar <clementamar@gmail.com>
---
 drivers/virtio/virtio.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/virtio/virtio.c b/drivers/virtio/virtio.c
index 5bdc6b82b..b49113ea8 100644
--- a/drivers/virtio/virtio.c
+++ b/drivers/virtio/virtio.c
@@ -493,16 +493,12 @@ static int virtio_device_of_init(struct virtio_device *dev)
 	 * Simply don't init of_node in this case.
 	 */
 	if (!of_device_is_compatible(np, compat)) {
-		ret = 0;
-		goto out;
+		of_node_put(np);
+		return 0;
 	}
 
 	dev->dev.of_node = np;
 	return 0;
-
-out:
-	of_node_put(np);
-	return ret;
 }
 
 /**
-- 
2.43.0


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

* Re: [PATCH] virtio: simplify of_node handling in virtio_device_of_init
  2026-04-06  9:21 [PATCH] virtio: simplify of_node handling in virtio_device_of_init Clement Amar
@ 2026-04-06  9:26 ` Michael S. Tsirkin
  0 siblings, 0 replies; 2+ messages in thread
From: Michael S. Tsirkin @ 2026-04-06  9:26 UTC (permalink / raw)
  To: Clement Amar
  Cc: Jason Wang, Xuan Zhuo, Eugenio Pérez, virtualization,
	linux-kernel

On Mon, Apr 06, 2026 at 11:21:59AM +0200, Clement Amar wrote:
> Replace goto with return for simple error
> 
> Signed-off-by: Clement Amar <clementamar@gmail.com>

I don't see the point, sorry.

> ---
>  drivers/virtio/virtio.c | 8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/virtio/virtio.c b/drivers/virtio/virtio.c
> index 5bdc6b82b..b49113ea8 100644
> --- a/drivers/virtio/virtio.c
> +++ b/drivers/virtio/virtio.c
> @@ -493,16 +493,12 @@ static int virtio_device_of_init(struct virtio_device *dev)
>  	 * Simply don't init of_node in this case.
>  	 */
>  	if (!of_device_is_compatible(np, compat)) {
> -		ret = 0;
> -		goto out;
> +		of_node_put(np);
> +		return 0;
>  	}
>  
>  	dev->dev.of_node = np;
>  	return 0;
> -
> -out:
> -	of_node_put(np);
> -	return ret;
>  }
>  
>  /**
> -- 
> 2.43.0


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

end of thread, other threads:[~2026-04-06  9:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-06  9:21 [PATCH] virtio: simplify of_node handling in virtio_device_of_init Clement Amar
2026-04-06  9:26 ` Michael S. Tsirkin

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