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 e635b050e4959c9a47f41684b9064d8cc3d69288..53971c8dffc9a86d5516cd4cb7dbfe94cbf5e881 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);