Re: [PATCH] virtio: simplify of_node handling in virtio_device_of_init
From: Michael S. Tsirkin
Date: Mon Apr 06 2026 - 05:28:19 EST
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@xxxxxxxxx>
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