[media] dvb core: must check dvb_create_media_graph()

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>
This commit is contained in:
Mauro Carvalho Chehab 2015-09-04 15:33:46 -03:00
parent 13f6e8887a
commit 0d3ab8410d
6 changed files with 23 additions and 9 deletions

View File

@ -1183,7 +1183,11 @@ static int smsdvb_hotplug(struct smscore_device_t *coredev,
if (smsdvb_debugfs_create(client) < 0) if (smsdvb_debugfs_create(client) < 0)
pr_info("failed to create debugfs node\n"); 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"); pr_info("DVB interface registered.\n");
return 0; return 0;

View File

@ -206,7 +206,7 @@ int dvb_register_device(struct dvb_adapter *adap,
void dvb_unregister_device(struct dvb_device *dvbdev); void dvb_unregister_device(struct dvb_device *dvbdev);
#ifdef CONFIG_MEDIA_CONTROLLER_DVB #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, static inline void dvb_register_media_controller(struct dvb_adapter *adap,
struct media_device *mdev) struct media_device *mdev)
{ {

View File

@ -486,12 +486,14 @@ static int dvb_register(struct au0828_dev *dev)
dvb->start_count = 0; dvb->start_count = 0;
dvb->stop_count = 0; dvb->stop_count = 0;
#ifdef CONFIG_MEDIA_CONTROLLER_DVB result = dvb_create_media_graph(&dvb->adapter);
dvb_create_media_graph(&dvb->adapter); if (result < 0)
#endif goto fail_create_graph;
return 0; return 0;
fail_create_graph:
dvb_net_release(&dvb->net);
fail_fe_conn: fail_fe_conn:
dvb->demux.dmx.remove_frontend(&dvb->demux.dmx, &dvb->fe_mem); dvb->demux.dmx.remove_frontend(&dvb->demux.dmx, &dvb->fe_mem);
fail_fe_mem: fail_fe_mem:

View File

@ -551,10 +551,14 @@ static int register_dvb(struct cx231xx_dvb *dvb,
/* register network adapter */ /* register network adapter */
dvb_net_init(&dvb->adapter, &dvb->net, &dvb->demux.dmx); 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; return 0;
fail_create_graph:
dvb_net_release(&dvb->net);
fail_fe_conn: fail_fe_conn:
dvb->demux.dmx.remove_frontend(&dvb->demux.dmx, &dvb->fe_mem); dvb->demux.dmx.remove_frontend(&dvb->demux.dmx, &dvb->fe_mem);
fail_fe_mem: fail_fe_mem:

View 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; return 0;

View File

@ -318,10 +318,12 @@ int dvb_usb_adapter_frontend_init(struct dvb_usb_adapter *adap)
adap->num_frontends_initialized++; 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) int dvb_usb_adapter_frontend_exit(struct dvb_usb_adapter *adap)