@@ -241,7 +241,7 @@ static int hub_master_probe(struct device *dev)
rc = fsi_master_register(&hub->master);
if (rc)
- goto err_release;
+ goto err_register;
/* At this point, fsi_master_register performs the device_initialize(),
* and holds the sole reference on master.dev. This means the device
@@ -253,6 +253,8 @@ static int hub_master_probe(struct device *dev)
get_device(&hub->master.dev);
return 0;
+err_register:
+ put_device(&hub->master.dev);
err_release:
fsi_slave_release_range(fsi_dev->slave, FSI_HUB_LINK_OFFSET,
FSI_HUB_LINK_SIZE * links);
If fsi_master_register() fails, the name allocated in dev_set_name() and the 'hub' need be freed, calling put_device(), so that the refcount of device is decreased to 0, the name and the 'hub' can be freed in callback function. Fixes: 7f9e8f767030 ("drivers/fsi: Add hub master support") Signed-off-by: Yang Yingliang <yangyingliang@huawei.com> --- drivers/fsi/fsi-master-hub.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)