mfd: core: Fix device reference leak in mfd_clone_cell
authorJohan Hovold <johan@kernel.org>
Tue, 1 Nov 2016 10:38:18 +0000 (11:38 +0100)
committerLee Jones <lee.jones@linaro.org>
Wed, 16 Nov 2016 09:50:41 +0000 (09:50 +0000)
Make sure to drop the reference taken by bus_find_device_by_name()
before returning from mfd_clone_cell().

Fixes: a9bbba996302 ("mfd: add platform_device sharing support for mfd")
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
drivers/mfd/mfd-core.c

index 3ac486a597f3c31e8e362f1f9954098cdf081086..c57e407020f11dd19aff3a9dd4b9ba7ce9c7b351 100644 (file)
@@ -399,6 +399,8 @@ int mfd_clone_cell(const char *cell, const char **clones, size_t n_clones)
                                        clones[i]);
        }
 
+       put_device(dev);
+
        return 0;
 }
 EXPORT_SYMBOL(mfd_clone_cell);