summaryrefslogtreecommitdiffstats
path: root/src/udev
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2020-07-21 04:39:44 +0200
committerYu Watanabe <watanabe.yu+github@gmail.com>2020-07-21 04:55:28 +0200
commit28266c446a64597c55f68e33c086da7465541a21 (patch)
tree89f9667d7aa633eab8b4b561ce0efbfa9008f8bf /src/udev
parentudev: save ID_RENAMING= property to database before renaming network interface (diff)
downloadsystemd-28266c446a64597c55f68e33c086da7465541a21.tar.xz
systemd-28266c446a64597c55f68e33c086da7465541a21.zip
udev: drop unnecessary checks
Also, drop one unnecessary sd_device_unref(), as dev_db_clone will be unref()ed in udev_event_free().
Diffstat (limited to 'src/udev')
-rw-r--r--src/udev/udev-event.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/src/udev/udev-event.c b/src/udev/udev-event.c
index 2ae76eb51a..e1c2baf7f2 100644
--- a/src/udev/udev-event.c
+++ b/src/udev/udev-event.c
@@ -881,8 +881,7 @@ static int update_devnode(UdevEvent *event) {
return log_device_error_errno(dev, r, "Failed to get devnum: %m");
/* remove/update possible left-over symlinks from old database entry */
- if (event->dev_db_clone)
- (void) udev_node_update_old_links(dev, event->dev_db_clone);
+ (void) udev_node_update_old_links(dev, event->dev_db_clone);
if (!uid_is_valid(event->uid)) {
r = device_get_devnode_uid(dev, &event->uid);
@@ -945,8 +944,7 @@ static int udev_event_on_move(UdevEvent *event) {
sd_device *dev = event->dev;
int r;
- if (event->dev_db_clone &&
- sd_device_get_devnum(dev, NULL) < 0) {
+ if (sd_device_get_devnum(dev, NULL) < 0) {
r = device_copy_properties(dev, event->dev_db_clone);
if (r < 0)
log_device_debug_errno(dev, r, "Failed to copy properties from cloned sd_device object, ignoring: %m");
@@ -992,7 +990,7 @@ int udev_event_execute_rules(UdevEvent *event,
if (r < 0)
return log_device_debug_errno(dev, r, "Failed to clone sd_device object: %m");
- if (event->dev_db_clone && sd_device_get_devnum(dev, NULL) >= 0)
+ if (sd_device_get_devnum(dev, NULL) >= 0)
/* Disable watch during event processing. */
(void) udev_watch_end(event->dev_db_clone);
@@ -1030,8 +1028,6 @@ int udev_event_execute_rules(UdevEvent *event,
device_set_is_initialized(dev);
- event->dev_db_clone = sd_device_unref(event->dev_db_clone);
-
return 0;
}