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

wsc: Rework wsc_enrollee_destroy

Our design preference is to not call any callbacks in the _free/_destroy
method of a class (with the exception of explicit destroy callbacks
provided, if any).

Invoking the callback in this case was unnecessary: wsc_dbus_free was
already replying to pending connect / cancel messages.  The only other
thing the callback would attempt to do is to set station back into
autoconnect mode.  This was unnecessary as well since the netdev is
already down.

This change removes the callback invocation.  Since wsc_enrollee_destroy
is now just calling wsc_enrollee_free, remove this from the API and
expose wsc_enrollee_free instead.
This commit is contained in:
Denis Kenzior 2020-01-17 11:18:23 -06:00
parent 1f14941011
commit ec15838215
2 changed files with 6 additions and 18 deletions

View File

@ -101,13 +101,6 @@ static struct l_dbus_message *wsc_error_time_expired(struct l_dbus_message *msg)
"the alloted time"); "the alloted time");
} }
static void wsc_enrollee_free(struct wsc_enrollee *wsce)
{
l_settings_free(wsce->eap_settings);
explicit_bzero(wsce->creds, sizeof(wsce->creds));
l_free(wsce);
}
static void wsc_enrollee_connect_cb(struct netdev *netdev, static void wsc_enrollee_connect_cb(struct netdev *netdev,
enum netdev_result result, enum netdev_result result,
void *event_data, void *user_data) void *event_data, void *user_data)
@ -448,16 +441,11 @@ void wsc_enrollee_cancel(struct wsc_enrollee *wsce, bool defer_cb)
} }
} }
/* To be called instead of wsc_enrollee_cancel if we know the netdev is gone */ void wsc_enrollee_free(struct wsc_enrollee *wsce)
void wsc_enrollee_destroy(struct wsc_enrollee *wsce)
{ {
/* l_settings_free(wsce->eap_settings);
* Note: wsc_enrollee_cancel(wsce, true) may have been called before explicit_bzero(wsce->creds, sizeof(wsce->creds));
* but since the netdev is going away wsc_enrollee_disconnect_cb l_free(wsce);
* is not happening anymore.
*/
wsce->done_cb(-ECANCELED, NULL, 0, wsce->done_data);
wsc_enrollee_free(wsce);
} }
struct wsc_station_dbus { struct wsc_station_dbus {
@ -1140,7 +1128,7 @@ static void wsc_station_dbus_remove(struct wsc_dbus *super)
} }
if (wsc->enrollee) if (wsc->enrollee)
wsc_enrollee_destroy(wsc->enrollee); wsc_enrollee_free(wsc->enrollee);
l_free(wsc); l_free(wsc);
} }

View File

@ -42,7 +42,7 @@ struct wsc_enrollee *wsc_enrollee_new(struct netdev *netdev,
struct iovec *ies, unsigned int ies_num, struct iovec *ies, unsigned int ies_num,
wsc_done_cb_t done_cb, void *user_data); wsc_done_cb_t done_cb, void *user_data);
void wsc_enrollee_cancel(struct wsc_enrollee *wsce, bool defer_cb); void wsc_enrollee_cancel(struct wsc_enrollee *wsce, bool defer_cb);
void wsc_enrollee_destroy(struct wsc_enrollee *wsce); void wsc_enrollee_free(struct wsc_enrollee *wsce);
struct wsc_dbus { struct wsc_dbus {
struct l_dbus_message *pending_connect; struct l_dbus_message *pending_connect;