Skip to contentSkip to conversation

virtio: simplify of_node handling in virtio_device_of_init

PATCH In review Clement Amar 2 participants 2 messages Apr 6 virtio core

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 virtio: simplify of_node handling in virtio_device_of_init

Replace goto with return for simple error

---
 drivers/virtio/virtio.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/virtio/virtio.c +2 -6
index 5bdc6b82b..b49113ea8 100644
@@ -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;
 }
 
 /**
Signature · 1 line
2.43.0
#1 lore raw
Quoted 3 lines · Clement Amar

Replace goto with return for simple error

I don't see the point, sorry.

Quoted 29 lines
---
 drivers/virtio/virtio.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/virtio/virtio.c +2 -6
index 5bdc6b82b..b49113ea8 100644
@@ -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;
 }
 
 /**
Signature · 1 line
2.43.0