public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] media: em28xx: return error on media_device_register() failure
@ 2024-01-10 17:39 Nikita Zhandarovich
  2024-01-10 19:15 ` Christophe JAILLET
  2024-01-11  6:49 ` Mauro Carvalho Chehab
  0 siblings, 2 replies; 5+ messages in thread
From: Nikita Zhandarovich @ 2024-01-10 17:39 UTC (permalink / raw)
  To: Mauro Carvalho Chehab; +Cc: Nikita Zhandarovich, linux-media, linux-kernel

In an unlikely case of failure in media_device_register(), release
resources and return the erroneous value. Otherwise, possible issues
with registering the device will continue to be ignored.

Found by Linux Verification Center (linuxtesting.org) with static
analysis tool SVACE.

Fixes: 37ecc7b1278f ("[media] em28xx: add media controller support")
Signed-off-by: Nikita Zhandarovich <n.zhandarovich@fintech.ru>
---
 drivers/media/usb/em28xx/em28xx-cards.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/media/usb/em28xx/em28xx-cards.c b/drivers/media/usb/em28xx/em28xx-cards.c
index 4d037c92af7c..dae731dfc569 100644
--- a/drivers/media/usb/em28xx/em28xx-cards.c
+++ b/drivers/media/usb/em28xx/em28xx-cards.c
@@ -4095,6 +4095,8 @@ static int em28xx_usb_probe(struct usb_interface *intf,
 	 */
 #ifdef CONFIG_MEDIA_CONTROLLER
 	retval = media_device_register(dev->media_dev);
+	if (retval)
+		goto err_free;
 #endif
 
 	return 0;

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-01-11 17:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-10 17:39 [PATCH] media: em28xx: return error on media_device_register() failure Nikita Zhandarovich
2024-01-10 19:15 ` Christophe JAILLET
2024-01-11  6:49 ` Mauro Carvalho Chehab
2024-01-11 15:10   ` Nikita Zhandarovich
2024-01-11 17:40     ` Mauro Carvalho Chehab

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox