mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] media: tm6000: add error handling for dvb_register_adapter
@ 2018-06-11  4:39 Zhouyang Jia
  2018-06-12  5:47 ` [PATCH v2] " Zhouyang Jia
  0 siblings, 1 reply; 2+ messages in thread
From: Zhouyang Jia @ 2018-06-11  4:39 UTC (permalink / raw)
  Cc: Zhouyang Jia, Mauro Carvalho Chehab, Markus Elfring,
	Hans Verkuil, Colin Ian King, linux-media, linux-kernel

When dvb_register_adapter fails, the lack of error-handling code may
cause unexpected results.

This patch adds error-handling code after calling dvb_register_adapter.

Signed-off-by: Zhouyang Jia <jiazhouyang09@gmail.com>
---
 drivers/media/usb/tm6000/tm6000-dvb.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/media/usb/tm6000/tm6000-dvb.c b/drivers/media/usb/tm6000/tm6000-dvb.c
index c811fc6..ff35d4b 100644
--- a/drivers/media/usb/tm6000/tm6000-dvb.c
+++ b/drivers/media/usb/tm6000/tm6000-dvb.c
@@ -266,6 +266,11 @@ static int register_dvb(struct tm6000_core *dev)
 
 	ret = dvb_register_adapter(&dvb->adapter, "Trident TVMaster 6000 DVB-T",
 					THIS_MODULE, &dev->udev->dev, adapter_nr);
+	if (ret < 0) {
+		printk(KERN_ERR "tm6000: couldn't register the adater!\n");
+		goto err;
+	}
+
 	dvb->adapter.priv = dev;
 
 	if (dvb->frontend) {
-- 
2.7.4

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

end of thread, other threads:[~2018-06-12  5:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-11  4:39 [PATCH] media: tm6000: add error handling for dvb_register_adapter Zhouyang Jia
2018-06-12  5:47 ` [PATCH v2] " Zhouyang Jia

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

all inboxes | Powered by JetHome®