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

device: Return an error if netdev_set_powered fails

netdev_set_powered could in theory return an error.  So handle this
case by returning an error from the property set call.
This commit is contained in:
Denis Kenzior 2018-08-17 11:52:47 -05:00
parent eab0731cb1
commit 3a9b1f2e38

View File

@ -2296,6 +2296,7 @@ static struct l_dbus_message *device_property_set_powered(struct l_dbus *dbus,
struct device *device = user_data; struct device *device = user_data;
bool powered; bool powered;
struct set_generic_cb_data *cb_data; struct set_generic_cb_data *cb_data;
int r;
if (!l_dbus_message_iter_get_variant(new_value, "b", &powered)) if (!l_dbus_message_iter_get_variant(new_value, "b", &powered))
return dbus_error_invalid_args(message); return dbus_error_invalid_args(message);
@ -2312,8 +2313,12 @@ static struct l_dbus_message *device_property_set_powered(struct l_dbus *dbus,
cb_data->message = message; cb_data->message = message;
cb_data->complete = complete; cb_data->complete = complete;
netdev_set_powered(device->netdev, powered, set_powered_cb, cb_data, r = netdev_set_powered(device->netdev, powered, set_powered_cb,
l_free); cb_data, l_free);
if (r < 0) {
l_free(cb_data);
return dbus_error_from_errno(r, message);
}
return NULL; return NULL;
} }