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)
committerWilly Tarreau <w@1wt.eu>
Fri, 10 Feb 2017 10:04:00 +0000 (11:04 +0100)
commit 722f191080de641f023feaa7d5648caf377844f5 upstream.

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>
Signed-off-by: Willy Tarreau <w@1wt.eu>
drivers/mfd/mfd-core.c

index 7604f4e5df40a10e03693407da38cb82ea3de14b..af6a245dc5057e2867ff36c29a1f22f0d85765e1 100644 (file)
@@ -263,6 +263,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);