[PATCH] virtio: simplify of_node handling in virtio_device_of_init

Clement Amar
2026-04-06T09:22:06Z

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