On Mon Mar 25 09:11:09 2024 +0000, Rémi Bernon wrote:
if (!syspath) WARN("udev device %p does not have syspath!\n", dev); else if (!action) WARN("event for udev device %s does not have any action!\n", syspath); else if (!devnode) { /* Pretty normal case, not all devices have associated * devnodes. For example root input devices do not, but * related/child mouse and event devices do. */ TRACE("udev device %s does not have devnode, ignoring\n", syspath); } else if (strcmp(action, "remove")) udev_add_device(dev, -1); else { impl = find_device_from_devnode(devnode); if (impl) bus_event_queue_device_removed(&event_queue, &impl->unix_device); else WARN("failed to find device for udev device %p\n", dev); } udev_device_unref(dev);
I think the `!syspath` case deserves `ERR`: all devices in sysfs tree always have unique paths. If udev abstraction somehow fails to convey it, then something is really broken and basically all bets are off regarding current device state.
I think `!action` case is similar; it means that something has happened in the device setup but udev has failed to tell us what. That case was logged as WARN and I didn't want to touch that because it was not necessary in the context of this MR.
Anyways, point taken, I'll get rid of "on error goto out" -pattern (which I personally tend to prefer).