summaryrefslogtreecommitdiff
path: root/drivers/thunderbolt
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2021-03-29 09:07:18 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-04-14 09:42:03 +0300
commit256ece954961411c9dc77a08566cda47fabc8d71 (patch)
treee6f08ac6b1ab9a3a93fb2774801820e2f7086023 /drivers/thunderbolt
parentb830650c1a0c665a48a24b7cf4bf46f7e5b10119 (diff)
downloadlinux-256ece954961411c9dc77a08566cda47fabc8d71.tar.xz
thunderbolt: Fix a leak in tb_retimer_add()
commit bec4d7c93afc07dd0454ae41c559513f858cfb83 upstream. After the device_register() succeeds, then the correct way to clean up is to call device_unregister(). The unregister calls both device_del() and device_put(). Since this code was only device_del() it results in a memory leak. Fixes: dacb12877d92 ("thunderbolt: Add support for on-board retimers") Cc: stable@vger.kernel.org Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Reviewed-by: Jason Gunthorpe <jgg@nvidia.com> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/thunderbolt')
-rw-r--r--drivers/thunderbolt/retimer.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/thunderbolt/retimer.c b/drivers/thunderbolt/retimer.c
index 620bcf586ee2..7a5d61604c8b 100644
--- a/drivers/thunderbolt/retimer.c
+++ b/drivers/thunderbolt/retimer.c
@@ -347,7 +347,7 @@ static int tb_retimer_add(struct tb_port *port, u8 index, u32 auth_status)
ret = tb_retimer_nvm_add(rt);
if (ret) {
dev_err(&rt->dev, "failed to add NVM devices: %d\n", ret);
- device_del(&rt->dev);
+ device_unregister(&rt->dev);
return ret;
}