3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-12-23 06:02:37 +01:00

device: Don't return an error on no state change

If device is already disconnected or in autoconnect mode, don't return
an error if .Disconnect is called.  Instead simply silently return
success after disabling autoconnect.
This commit is contained in:
Denis Kenzior 2018-07-03 16:13:39 -05:00
parent 73e0394d7f
commit 5b8f052524

View File

@ -1883,6 +1883,10 @@ static struct l_dbus_message *device_dbus_disconnect(struct l_dbus *dbus,
*/ */
device_set_autoconnect(device, false); device_set_autoconnect(device, false);
if (device->state == DEVICE_STATE_AUTOCONNECT ||
device->state == DEVICE_STATE_DISCONNECTED)
return l_dbus_message_new_method_return(message);
result = device_disconnect(device); result = device_disconnect(device);
if (result < 0) if (result < 0)
return dbus_error_from_errno(result, message); return dbus_error_from_errno(result, message);