]> www.infradead.org Git - users/dwmw2/linux.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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 14 Jul 2021 14:53:13 +0000 (16:53 +0200)
[ Upstream commit 5368b1ee2939961a16e74972b69088433fc52195 ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/media/common/siano/smsdvb-main.c

index ae17407e477a49f1b8977d2de34e35e57a4980cd..7cc654bc52d37654efabd33f9926078019e2acae 100644 (file)
@@ -1176,6 +1176,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: