From 324a45568ac2983be3c0d48d9437e8994a1bf31c Mon Sep 17 00:00:00 2001 From: Krishna T Date: Fri, 6 Jan 2023 17:10:50 +0530 Subject: [PATCH] net: wifi: Fix unnecessary intermediate variable Directly return the function return value. Signed-off-by: Krishna T --- subsys/net/l2/wifi/wifi_mgmt.c | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/subsys/net/l2/wifi/wifi_mgmt.c b/subsys/net/l2/wifi/wifi_mgmt.c index d76892c7823..dceafc81dec 100644 --- a/subsys/net/l2/wifi/wifi_mgmt.c +++ b/subsys/net/l2/wifi/wifi_mgmt.c @@ -168,7 +168,6 @@ NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_WIFI_AP_DISABLE, wifi_ap_disable); static int wifi_iface_status(uint32_t mgmt_request, struct net_if *iface, void *data, size_t len) { - int ret; const struct device *dev = net_if_get_device(iface); struct net_wifi_mgmt_offload *off_api = (struct net_wifi_mgmt_offload *) dev->api; @@ -182,13 +181,7 @@ static int wifi_iface_status(uint32_t mgmt_request, struct net_if *iface, return -EINVAL; } - ret = off_api->iface_status(dev, status); - - if (ret) { - return ret; - } - - return 0; + return off_api->iface_status(dev, status); } NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_WIFI_IFACE_STATUS, wifi_iface_status); @@ -204,7 +197,6 @@ void wifi_mgmt_raise_iface_status_event(struct net_if *iface, static int wifi_iface_stats(uint32_t mgmt_request, struct net_if *iface, void *data, size_t len) { - int ret; const struct device *dev = net_if_get_device(iface); struct net_wifi_mgmt_offload *off_api = (struct net_wifi_mgmt_offload *) dev->api; @@ -218,13 +210,7 @@ static int wifi_iface_stats(uint32_t mgmt_request, struct net_if *iface, return -EINVAL; } - ret = off_api->get_stats(dev, stats); - - if (ret) { - return ret; - } - - return 0; + return off_api->get_stats(dev, stats); } NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_STATS_GET_WIFI, wifi_iface_stats); #endif /* CONFIG_NET_STATISTICS_WIFI */