summaryrefslogtreecommitdiffhomepage
path: root/device.c
diff options
context:
space:
mode:
Diffstat (limited to 'device.c')
-rw-r--r--device.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/device.c b/device.c
index 6eb730e..1136380 100644
--- a/device.c
+++ b/device.c
@@ -179,8 +179,7 @@ alias_notify_device(const char *name, struct device *dev)
alias->cleanup = !dev;
if (dev) {
if (dev != alias->dep.dev) {
- if (alias->dep.dev)
- device_remove_user(&alias->dep);
+ device_remove_user(&alias->dep);
strcpy(alias->dev.ifname, dev->ifname);
device_add_user(&alias->dep, dev);
}
@@ -396,6 +395,9 @@ void device_remove_user(struct device_user *dep)
{
struct device *dev = dep->dev;
+ if (!dep->dev)
+ return;
+
if (dep->claimed)
device_release(dep);