dev = udev_monitor_receive_device(monitor);
if (dev) {
- if (strcmp(udev_device_get_sysname(dev), pwmchip_name) == 0 &&
- strcmp(udev_device_get_property_value(dev, "EXPORT"), pwm_name) == 0) {
- _D("udev for %s is initialized", pwm_name);
- udev_device_unref(dev);
- return 0;
+ if (strcmp(udev_device_get_sysname(dev), pwmchip_name) == 0) {
+ const char *prop = udev_device_get_property_value(dev, "EXPORT");
+ if (prop && strcmp(prop, pwm_name) == 0) {
+ _D("udev for %s is initialized", pwm_name);
+ udev_device_unref(dev);
+ return 0;
+ }
}
udev_device_unref(dev);
}
_E("close() failed: %m");
ret = PERIPHERAL_ERROR_IO_ERROR;
goto out;
+ } else {
+ fd = -1;
}
ret = __pwm_wait_for_udev(monitor, chip, pin);