net: wifi: Fix unnecessary intermediate variable

Directly return the function return value.

Signed-off-by: Krishna T <krishna.t@nordicsemi.no>
This commit is contained in:
Krishna T 2023-01-06 17:10:50 +05:30 committed by Fabio Baltieri
commit 324a45568a

View file

@ -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, static int wifi_iface_status(uint32_t mgmt_request, struct net_if *iface,
void *data, size_t len) void *data, size_t len)
{ {
int ret;
const struct device *dev = net_if_get_device(iface); const struct device *dev = net_if_get_device(iface);
struct net_wifi_mgmt_offload *off_api = struct net_wifi_mgmt_offload *off_api =
(struct net_wifi_mgmt_offload *) dev->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; return -EINVAL;
} }
ret = off_api->iface_status(dev, status); return off_api->iface_status(dev, status);
if (ret) {
return ret;
}
return 0;
} }
NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_WIFI_IFACE_STATUS, wifi_iface_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, static int wifi_iface_stats(uint32_t mgmt_request, struct net_if *iface,
void *data, size_t len) void *data, size_t len)
{ {
int ret;
const struct device *dev = net_if_get_device(iface); const struct device *dev = net_if_get_device(iface);
struct net_wifi_mgmt_offload *off_api = struct net_wifi_mgmt_offload *off_api =
(struct net_wifi_mgmt_offload *) dev->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; return -EINVAL;
} }
ret = off_api->get_stats(dev, stats); return off_api->get_stats(dev, stats);
if (ret) {
return ret;
}
return 0;
} }
NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_STATS_GET_WIFI, wifi_iface_stats); NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_STATS_GET_WIFI, wifi_iface_stats);
#endif /* CONFIG_NET_STATISTICS_WIFI */ #endif /* CONFIG_NET_STATISTICS_WIFI */