Merge tag 'renesas-soc-fixes3-for-v3.19' of git://git.kernel.org/pub/scm/linux/kernel...
[firefly-linux-kernel-4.4.55.git] / drivers / base / bus.c
index 83e910a57563c021d5e803adc2ae4ee7f43447ec..876bae5ade3393464bd7b2250af8f1ed29bf5bc8 100644 (file)
@@ -254,13 +254,15 @@ static ssize_t store_drivers_probe(struct bus_type *bus,
                                   const char *buf, size_t count)
 {
        struct device *dev;
+       int err = -EINVAL;
 
        dev = bus_find_device_by_name(bus, NULL, buf);
        if (!dev)
                return -ENODEV;
-       if (bus_rescan_devices_helper(dev, NULL) != 0)
-               return -EINVAL;
-       return count;
+       if (bus_rescan_devices_helper(dev, NULL) == 0)
+               err = count;
+       put_device(dev);
+       return err;
 }
 
 static struct device *next_device(struct klist_iter *i)