gpio: exit if we can't request output GPIOs

This means the system is in a very bad shape as no other software should 
make use of those, so exit the daemon (will be restarted by systemd).
This commit is contained in:
Arnaud Ferraris
2020-12-13 00:35:17 +01:00
parent 90a016a8f6
commit 8c9a2b21f9

View File

@@ -131,13 +131,13 @@ int gpio_init(struct EG25Manager *manager)
manager->gpio_out[i] = gpiod_chip_get_line(manager->gpiochip[chipidx], offset); manager->gpio_out[i] = gpiod_chip_get_line(manager->gpiochip[chipidx], offset);
if (!manager->gpio_out[i]) { if (!manager->gpio_out[i]) {
g_critical("Unable to get output GPIO %d", i); g_error("Unable to get output GPIO %d", i);
return 1; return 1;
} }
ret = gpiod_line_request_output(manager->gpio_out[i], "eg25manager", 0); ret = gpiod_line_request_output(manager->gpio_out[i], "eg25manager", 0);
if (ret < 0) { if (ret < 0) {
g_critical("Unable to request output GPIO %d", i); g_error("Unable to request output GPIO %d", i);
return 1; return 1;
} }
} }