From 178549316340a266256a9a57637c08a75824d45a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20Sj=C3=B6lund?= Date: Mon, 27 Jul 2026 08:07:14 +0200 Subject: [PATCH] net_device: drop unnecessary variable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 4.8 Signed-off-by: Erik Sjölund --- src/libcrun/net_device.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/libcrun/net_device.c b/src/libcrun/net_device.c index 8c5b54f039..3c5a66070c 100644 --- a/src/libcrun/net_device.c +++ b/src/libcrun/net_device.c @@ -152,7 +152,6 @@ name_to_index (int sock, const char *ifname, char *buffer, size_t buffer_size, l struct nlmsghdr *nlh; struct nl_req *req; uint32_t seq; - int index = 0; ssize_t len; int ret; @@ -191,15 +190,11 @@ name_to_index (int sock, const char *ifname, char *buffer, size_t buffer_size, l if (nlh->nlmsg_type == RTM_NEWLINK) { struct ifinfomsg *ifi = NLMSG_DATA (nlh); - index = ifi->ifi_index; - return index; + return ifi->ifi_index; } } - if (index == 0) - return crun_make_error (err, 0, "could not find device `%s`", ifname); - - return index; + return crun_make_error (err, 0, "could not find device `%s`", ifname); } static int