if (r <= 0)
return;
- r = check_already_handled(devnode);
- if (r < 0) {
- _I("%s is already handled", devnode);
- return;
- }
-
action = udev_device_get_action(dev);
if (!action)
return;
_I("%s device %s", devnode, action);
- if (!strncmp(action, UDEV_ADD, sizeof(UDEV_ADD)))
+ if (!strncmp(action, UDEV_ADD, sizeof(UDEV_ADD))) {
+ r = check_already_handled(devnode);
+ if (r < 0) {
+ _I("%s is already handled", devnode);
+ return;
+ }
+
add_block_device(dev, devnode);
- else if (!strncmp(action, UDEV_REMOVE, sizeof(UDEV_REMOVE)))
+ } else if (!strncmp(action, UDEV_REMOVE, sizeof(UDEV_REMOVE)))
remove_block_device(dev, devnode);
}