manager: improve error checking in modem_reset()

This commit is contained in:
Arnaud Ferraris
2020-12-30 17:31:44 +01:00
parent cb5220a1b8
commit c2e83f15a6

View File

@@ -121,7 +121,7 @@ static gboolean modem_reset_done(struct EG25Manager* manager)
void modem_reset(struct EG25Manager *manager)
{
int fd, ret, len = strlen(manager->modem_usb_id);
int fd, ret, len;
if (manager->reset_timer)
return;
@@ -131,6 +131,13 @@ void modem_reset(struct EG25Manager *manager)
manager->suspend_timer = 0;
}
if (!manager->modem_usb_id) {
g_warning("Unknown modem USB ID");
goto error;
}
len = strlen(manager->modem_usb_id);
manager->modem_state = EG25_STATE_RESETTING;
fd = open("/sys/bus/usb/drivers/usb/unbind", O_WRONLY);