device_add_user: return immediately if the new device is the same as the old device
authorFelix Fietkau <nbd@openwrt.org>
Thu, 3 Oct 2013 13:10:33 +0000 (15:10 +0200)
committerFelix Fietkau <nbd@openwrt.org>
Thu, 3 Oct 2013 13:10:33 +0000 (15:10 +0200)
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
device.c

index e635b05..53971c8 100644 (file)
--- a/device.c
+++ b/device.c
@@ -408,6 +408,9 @@ void device_add_user(struct device_user *dep, struct device *dev)
 {
        struct safe_list *head;
 
+       if (dep->dev == dev)
+               return;
+
        if (dep->dev)
                device_remove_user(dep);