1
0
Fork 0

rapidio: fix the missed put_device() for rio_mport_add_riodev

[ Upstream commit 85094c05ee ]

rio_mport_add_riodev() misses to call put_device() when the device already
exists.  Add the missed function call to fix it.

Fixes: e8de370188 ("rapidio: add mport char device driver")
Signed-off-by: Jing Xiangfeng <jingxiangfeng@huawei.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Matt Porter <mporter@kernel.crashing.org>
Cc: Alexandre Bounine <alex.bou9@gmail.com>
Cc: Gustavo A. R. Silva <gustavoars@kernel.org>
Cc: John Hubbard <jhubbard@nvidia.com>
Cc: Kees Cook <keescook@chromium.org>
Cc: Madhuparna Bhowmik <madhuparnabhowmik10@gmail.com>
Link: https://lkml.kernel.org/r/20200922072525.42330-1-jingxiangfeng@huawei.com
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
5.4-rM2-2.2.x-imx-squashed
Jing Xiangfeng 2020-10-15 20:13:18 -07:00 committed by Greg Kroah-Hartman
parent bfab0711eb
commit fe1936208e
1 changed files with 4 additions and 1 deletions

View File

@ -1683,6 +1683,7 @@ static int rio_mport_add_riodev(struct mport_cdev_priv *priv,
struct rio_dev *rdev;
struct rio_switch *rswitch = NULL;
struct rio_mport *mport;
struct device *dev;
size_t size;
u32 rval;
u32 swpinfo = 0;
@ -1697,8 +1698,10 @@ static int rio_mport_add_riodev(struct mport_cdev_priv *priv,
rmcd_debug(RDEV, "name:%s ct:0x%x did:0x%x hc:0x%x", dev_info.name,
dev_info.comptag, dev_info.destid, dev_info.hopcount);
if (bus_find_device_by_name(&rio_bus_type, NULL, dev_info.name)) {
dev = bus_find_device_by_name(&rio_bus_type, NULL, dev_info.name);
if (dev) {
rmcd_debug(RDEV, "device %s already exists", dev_info.name);
put_device(dev);
return -EEXIST;
}