diff options
author | Johannes Stezenbach <devnull@localhost> | 2005-02-17 18:44:16 +0000 |
---|---|---|
committer | Johannes Stezenbach <devnull@localhost> | 2005-02-17 18:44:16 +0000 |
commit | a0ffcf1c9f8e8484b690b941fcdbb4e4be60eaeb (patch) | |
tree | 28391f0e70fadb11db22c7a8de84a69f01797024 /linux/drivers/media/dvb/ttpci/av7110_av.c | |
parent | ad57ce5aa84c8f7f614c5a1eb0cc0cdbf96998b8 (diff) | |
download | mediapointer-dvb-s2-a0ffcf1c9f8e8484b690b941fcdbb4e4be60eaeb.tar.gz mediapointer-dvb-s2-a0ffcf1c9f8e8484b690b941fcdbb4e4be60eaeb.tar.bz2 |
Janitoring - error handling during attach
- av7110_arm_sync(): small helper to factor out some code;
- av7110_attach() does not check the status code returned by all the
functions is uses;
- balance the error path in av7110_attach and have it easy to check.
Please check it;
- if everything is correctly balanced, device_initialized is not needed
anymore in struct av7110;
- av7110_detach(): no need to cast a void * pointer;
- av7110_detach(): die #ifdef, die !
- change the returned value of av7110_av_exit() as it can't fail;
- change the returned value of av7110_ca_init() as it can fail. Removed
extraneous casts while are it;
- check for failure of vmalloc() in ci_ll_init().
Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>
Diffstat (limited to 'linux/drivers/media/dvb/ttpci/av7110_av.c')
-rw-r--r-- | linux/drivers/media/dvb/ttpci/av7110_av.c | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/linux/drivers/media/dvb/ttpci/av7110_av.c b/linux/drivers/media/dvb/ttpci/av7110_av.c index ae2b2bbe1..18e154140 100644 --- a/linux/drivers/media/dvb/ttpci/av7110_av.c +++ b/linux/drivers/media/dvb/ttpci/av7110_av.c @@ -1424,25 +1424,34 @@ void av7110_av_unregister(struct av7110 *av7110) int av7110_av_init(struct av7110 *av7110) { + void (*play[])(u8 *, int, void *) = { play_audio_cb, play_video_cb }; + int i, ret; + av7110->vidmode = VIDEO_MODE_PAL; - av7110_ipack_init(&av7110->ipack[0], IPACKS, play_audio_cb); - av7110->ipack[0].data = (void *) av7110; - av7110_ipack_init(&av7110->ipack[1], IPACKS, play_video_cb); - av7110->ipack[1].data = (void *) av7110; + for (i = 0; i < 2; i++) { + struct ipack *ipack = av7110->ipack + i; + + ret = av7110_ipack_init(ipack, IPACKS, play[i]); + if (ret < 0) { + if (i) + av7110_ipack_free(--ipack); + goto out; + } + ipack->data = av7110; + } dvb_ringbuffer_init(&av7110->avout, av7110->iobuf, AVOUTLEN); dvb_ringbuffer_init(&av7110->aout, av7110->iobuf + AVOUTLEN, AOUTLEN); av7110->kbuf[0] = (u8 *)(av7110->iobuf + AVOUTLEN + AOUTLEN + BMPLEN); av7110->kbuf[1] = av7110->kbuf[0] + 2 * IPACKS; - - return 0; +out: + return ret; } -int av7110_av_exit(struct av7110 *av7110) +void av7110_av_exit(struct av7110 *av7110) { av7110_ipack_free(&av7110->ipack[0]); av7110_ipack_free(&av7110->ipack[1]); - return 0; } |