summaryrefslogtreecommitdiffhomepage
path: root/device.c
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2011-10-19 02:08:25 +0200
committerFelix Fietkau <nbd@openwrt.org>2011-10-19 02:36:45 +0200
commitccca61c97d460d73f29750abdf38cea20ac440f3 (patch)
tree8e0c47f21ec7205c54a41811ee17a7aa03fd00eb /device.c
parentf8276b9b149f3b0c8f3cdf8d3d0c232bd92e3464 (diff)
rework and fix hotplug interface handling
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);