summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohan Hovold <johan@kernel.org>2015-12-14 16:16:19 +0100
committerZefan Li <lizefan@huawei.com>2016-10-26 23:15:38 +0800
commit1b17302a80d89c84ea3bdf7205ae363b7c12e3b7 (patch)
tree039cc2d3ae2cfa8e87006beea24a245d495d91e4
parent325c0423cb71364f51ac9d6f33739378ee19001b (diff)
downloadlinux-stable-1b17302a80d89c84ea3bdf7205ae363b7c12e3b7.tar.gz
linux-stable-1b17302a80d89c84ea3bdf7205ae363b7c12e3b7.tar.bz2
linux-stable-1b17302a80d89c84ea3bdf7205ae363b7c12e3b7.zip
spi: fix parent-device reference leak
commit 157f38f993919b648187ba341bfb05d0e91ad2f6 upstream. Fix parent-device reference leak due to SPI-core taking an unnecessary reference to the parent when allocating the master structure, a reference that was never released. Note that driver core takes its own reference to the parent when the master device is registered. Fixes: 49dce689ad4e ("spi doesn't need class_device") Signed-off-by: Johan Hovold <johan@kernel.org> Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Zefan Li <lizefan@huawei.com>
-rw-r--r--drivers/spi/spi.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index a3f31e9ab214..516fd23ba0d5 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -846,7 +846,7 @@ struct spi_master *spi_alloc_master(struct device *dev, unsigned size)
device_initialize(&master->dev);
master->dev.class = &spi_master_class;
- master->dev.parent = get_device(dev);
+ master->dev.parent = dev;
spi_master_set_devdata(master, &master[1]);
return master;