[media] dvb core: must check dvb_create_media_graph()
authorMauro Carvalho Chehab <mchehab@osg.samsung.com>
Fri, 4 Sep 2015 18:33:46 +0000 (15:33 -0300)
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>
Mon, 11 Jan 2016 14:18:59 +0000 (12:18 -0200)
If media controller is enabled and mdev is filled, it should
ensure that the media graph will be properly initialized.

Enforce that.

Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
drivers/media/common/siano/smsdvb-main.c
drivers/media/dvb-core/dvbdev.h
drivers/media/usb/au0828/au0828-dvb.c
drivers/media/usb/cx231xx/cx231xx-dvb.c
drivers/media/usb/dvb-usb-v2/dvb_usb_core.c
drivers/media/usb/dvb-usb/dvb-usb-dvb.c

index f4305ae800f4c9fc4540edfefca910c1f0ece166..ab345490a43add0a070bb207f03e06d3131a8b10 100644 (file)
@@ -1183,7 +1183,11 @@ static int smsdvb_hotplug(struct smscore_device_t *coredev,
        if (smsdvb_debugfs_create(client) < 0)
                pr_info("failed to create debugfs node\n");
 
-       dvb_create_media_graph(&client->adapter);
+       rc = dvb_create_media_graph(&client->adapter);
+       if (rc < 0) {
+               pr_err("dvb_create_media_graph failed %d\n", rc);
+               goto client_error;
+       }
 
        pr_info("DVB interface registered.\n");
        return 0;
index 3840dd62bfeeff99485a32583ee40b7ababeae34..de85ba0f570a815110e6aeda0ea3710df7310d94 100644 (file)
@@ -206,7 +206,7 @@ int dvb_register_device(struct dvb_adapter *adap,
 void dvb_unregister_device(struct dvb_device *dvbdev);
 
 #ifdef CONFIG_MEDIA_CONTROLLER_DVB
-int dvb_create_media_graph(struct dvb_adapter *adap);
+__must_check int dvb_create_media_graph(struct dvb_adapter *adap);
 static inline void dvb_register_media_controller(struct dvb_adapter *adap,
                                                 struct media_device *mdev)
 {
index c01772c4f9f07e1224adbea7312a7d16b14154c6..cd542b49a6c2bdab211bc49776bd1a1d01a00f8d 100644 (file)
@@ -486,12 +486,14 @@ static int dvb_register(struct au0828_dev *dev)
        dvb->start_count = 0;
        dvb->stop_count = 0;
 
-#ifdef CONFIG_MEDIA_CONTROLLER_DVB
-       dvb_create_media_graph(&dvb->adapter);
-#endif
+       result = dvb_create_media_graph(&dvb->adapter);
+       if (result < 0)
+               goto fail_create_graph;
 
        return 0;
 
+fail_create_graph:
+       dvb_net_release(&dvb->net);
 fail_fe_conn:
        dvb->demux.dmx.remove_frontend(&dvb->demux.dmx, &dvb->fe_mem);
 fail_fe_mem:
index e3594b9fab4a58247630a5b5d37af4eb8363b3db..b7552d20ebdb5594699bc28bf152604911b5af8f 100644 (file)
@@ -551,10 +551,14 @@ static int register_dvb(struct cx231xx_dvb *dvb,
 
        /* register network adapter */
        dvb_net_init(&dvb->adapter, &dvb->net, &dvb->demux.dmx);
-       dvb_create_media_graph(&dvb->adapter);
+       result = dvb_create_media_graph(&dvb->adapter);
+       if (result < 0)
+               goto fail_create_graph;
 
        return 0;
 
+fail_create_graph:
+       dvb_net_release(&dvb->net);
 fail_fe_conn:
        dvb->demux.dmx.remove_frontend(&dvb->demux.dmx, &dvb->fe_mem);
 fail_fe_mem:
index f5df9eaba04fb0843e40bb26555aec4eb8c0c641..6d3f61f6dc77513d95766909b12eedfab90e028d 100644 (file)
@@ -698,7 +698,9 @@ static int dvb_usbv2_adapter_frontend_init(struct dvb_usb_adapter *adap)
                }
        }
 
-       dvb_create_media_graph(&adap->dvb_adap);
+       ret = dvb_create_media_graph(&adap->dvb_adap);
+       if (ret < 0)
+               goto err_dvb_unregister_frontend;
 
        return 0;
 
index 8a260c854653d50d95a9529af459a21c9f0767bc..b51dbdf03f422740d848287c1ecbd92bcfcd7889 100644 (file)
@@ -318,10 +318,12 @@ int dvb_usb_adapter_frontend_init(struct dvb_usb_adapter *adap)
 
                adap->num_frontends_initialized++;
        }
+       if (ret)
+               return ret;
 
-       dvb_create_media_graph(&adap->dvb_adap);
+       ret = dvb_create_media_graph(&adap->dvb_adap);
 
-       return 0;
+       return ret;
 }
 
 int dvb_usb_adapter_frontend_exit(struct dvb_usb_adapter *adap)