3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-25 09:29:34 +01:00

p2p: Simplify cleanup of ies

Use an _auto_ variable to cleanup IEs allocated by
p2p_build_association_req().  While here, take out unneeded L_WARN_ON
since p2p_build_association_req cannot fail.
This commit is contained in:
Denis Kenzior 2023-11-29 23:43:40 -06:00
parent 305c4113e8
commit ba0d35ff38

View File

@ -1500,19 +1500,18 @@ static void p2p_try_connect_group(struct p2p_device *dev)
struct iovec ie_iov[16]; struct iovec ie_iov[16];
int ie_num = 0; int ie_num = 0;
int r; int r;
struct p2p_association_req info = {}; struct p2p_association_req info = {
.capability = dev->capability,
.device_info = dev->device_info,
};
struct ie_rsn_info bss_info = {}; struct ie_rsn_info bss_info = {};
struct ie_rsn_info rsn_info = {}; struct ie_rsn_info rsn_info = {};
uint8_t rsne_buf[256]; uint8_t rsne_buf[256];
uint8_t wfd_ie[32]; uint8_t wfd_ie[32];
_auto_(l_free) uint8_t *req_ie =
p2p_build_association_req(&info, &ie_iov[ie_num].iov_len);
info.capability = dev->capability; ie_iov[ie_num++].iov_base = req_ie;
info.device_info = dev->device_info;
ie_iov[0].iov_base = p2p_build_association_req(&info,
&ie_iov[0].iov_len);
L_WARN_ON(!ie_iov[0].iov_base);
ie_num = 1;
if (dev->conn_own_wfd) { if (dev->conn_own_wfd) {
ie_iov[ie_num].iov_base = wfd_ie; ie_iov[ie_num].iov_base = wfd_ie;
@ -1564,15 +1563,11 @@ static void p2p_try_connect_group(struct p2p_device *dev)
l_steal_ptr(hs); l_steal_ptr(hs);
dev->conn_retry_count++; dev->conn_retry_count++;
done:
l_free(ie_iov[0].iov_base);
return; return;
error: error:
not_supported: not_supported:
p2p_connect_failed(dev); p2p_connect_failed(dev);
goto done;
} }
static void p2p_peer_provision_done(int err, struct wsc_credentials_info *creds, static void p2p_peer_provision_done(int err, struct wsc_credentials_info *creds,