Skip to contentSkip to conversation

net/net: Clean up variable shadowing in net_client_init()

PATCH New Vladimir Sementsov-Ogievskiy 1 participant 1 message Nov 27, 2019 Networking

lore
Share & tools
lore
#0 lore raw

PATCH v6 1/1 net/net: Clean up variable shadowing in net_client_init()

Variable int err in inner scope shadows Error *err in outer scope.

---

v6: add Philippe's r-b

 net/net.c | 17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)
net/net.c +7 -10
index 84aa6d8d00..9e93c3f8a1 100644
@@ -1126,16 +1126,13 @@ static int net_client_init(QemuOpts *opts, bool is_netdev, Error **errp)
 
             prefix_addr = substrings[0];
 
-            if (substrings[1]) {
-                /* User-specified prefix length.  */
-                int err;
-
-                err = qemu_strtoul(substrings[1], NULL, 10, &prefix_len);
-                if (err) {
-                    error_setg(errp, QERR_INVALID_PARAMETER_VALUE,
-                               "ipv6-prefixlen", "a number");
-                    goto out;
-                }
+            /* Handle user-specified prefix length. */
+            if (substrings[1] &&
+                qemu_strtoul(substrings[1], NULL, 10, &prefix_len))
+            {
+                error_setg(errp, QERR_INVALID_PARAMETER_VALUE,
+                           "ipv6-prefixlen", "a number");
+                goto out;
             }
 
             qemu_opt_set(opts, "ipv6-prefix", prefix_addr, &error_abort);
Signature · 1 line
2.21.0