diff options
author | Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 2015-09-04 21:10:29 +0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 2016-01-11 17:18:57 +0300 |
commit | f50d51661af375c40cae894753e8cd9b1fe82c65 (patch) | |
tree | 1e0b1ff69cbb3c6ce4d14202749c3463bce57fb1 /drivers/media/dvb-core/dvbdev.h | |
parent | eb83a5176801d53f9f78eff8c0bf03e627110206 (diff) | |
download | linux-f50d51661af375c40cae894753e8cd9b1fe82c65.tar.xz |
[media] dvbdev: returns error if graph object creation fails
Right now, if something gets wrong at dvb_create_media_entity()
or at dvb_create_media_graph(), the device will still be
registered.
Change the logic to properly handle it and free all media graph
objects if something goes wrong at dvb_register_device().
Also, change the logic at dvb_create_media_graph() to return
an error code if something goes wrong. It is up to the
caller to implement the right logic and to call
dvb_unregister_device() to unregister the already-created
objects.
While here, add a missing logic to unregister the created
interfaces.
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Diffstat (limited to 'drivers/media/dvb-core/dvbdev.h')
-rw-r--r-- | drivers/media/dvb-core/dvbdev.h | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/media/dvb-core/dvbdev.h b/drivers/media/dvb-core/dvbdev.h index 7af8adbb589b..3840dd62bfee 100644 --- a/drivers/media/dvb-core/dvbdev.h +++ b/drivers/media/dvb-core/dvbdev.h @@ -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 -void dvb_create_media_graph(struct dvb_adapter *adap); +int dvb_create_media_graph(struct dvb_adapter *adap); static inline void dvb_register_media_controller(struct dvb_adapter *adap, struct media_device *mdev) { @@ -214,7 +214,10 @@ static inline void dvb_register_media_controller(struct dvb_adapter *adap, } #else -static inline void dvb_create_media_graph(struct dvb_adapter *adap) {} +static inline int dvb_create_media_graph(struct dvb_adapter *adap) +{ + return 0; +}; #define dvb_register_media_controller(a, b) {} #endif |