]> git.baikalelectronics.ru Git - kernel.git/commitdiff
media: siano: fix device register error path
authorMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Thu, 10 Jun 2021 06:57:02 +0000 (08:57 +0200)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Thu, 17 Jun 2021 07:27:08 +0000 (09:27 +0200)
As reported by smatch:
drivers/media/common/siano/smsdvb-main.c:1231 smsdvb_hotplug() warn: '&client->entry' not removed from list

If an error occur at the end of the registration logic, it won't
drop the device from the list.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
drivers/media/common/siano/smsdvb-main.c

index b8a163a47d09d317a35d0c78735cf0ec956298c4..f80caaa333daf53372598375ad5fc5a8aaa949e1 100644 (file)
@@ -1212,6 +1212,10 @@ static int smsdvb_hotplug(struct smscore_device_t *coredev,
        return 0;
 
 media_graph_error:
+       mutex_lock(&g_smsdvb_clientslock);
+       list_del(&client->entry);
+       mutex_unlock(&g_smsdvb_clientslock);
+
        smsdvb_debugfs_release(client);
 
 client_error: