diff options
author | Michael Krufky <mkrufky@linuxtv.org> | 2006-07-18 16:17:31 -0300 |
---|---|---|
committer | Michael Krufky <mkrufky@linuxtv.org> | 2006-07-18 16:17:31 -0300 |
commit | a51dd4ea79a5c23d0a701ec0cffb8fe7e190e2b8 (patch) | |
tree | 350462cfe4fb3a7971f14907ac3695b67473628c /linux/drivers/media | |
parent | 0139018d1bfbb5b35e768a0b1b721a538ec56e1d (diff) | |
download | mediapointer-dvb-s2-a51dd4ea79a5c23d0a701ec0cffb8fe7e190e2b8.tar.gz mediapointer-dvb-s2-a51dd4ea79a5c23d0a701ec0cffb8fe7e190e2b8.tar.bz2 |
videodev: check the return value of class_device_register
From: Michael Krufky <mkrufky@linuxtv.org>
If an error occurs during class_device_register, print an error message,
kfree(&vfd->class_dev), and return the error code to the caller
of video_register_device.
Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
Diffstat (limited to 'linux/drivers/media')
-rw-r--r-- | linux/drivers/media/video/videodev.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/linux/drivers/media/video/videodev.c b/linux/drivers/media/video/videodev.c index 5bc4e34dc..b13bbfe61 100644 --- a/linux/drivers/media/video/videodev.c +++ b/linux/drivers/media/video/videodev.c @@ -1532,6 +1532,7 @@ int video_register_device(struct video_device *vfd, int type, int nr) int i=0; int base; int end; + int ret; char *name_base; switch(type) @@ -1597,7 +1598,13 @@ int video_register_device(struct video_device *vfd, int type, int nr) vfd->class_dev.devt = MKDEV(VIDEO_MAJOR, vfd->minor); #endif strlcpy(vfd->class_dev.class_id, vfd->devfs_name + 4, BUS_ID_SIZE); - class_device_register(&vfd->class_dev); + ret = class_device_register(&vfd->class_dev); + if (ret) { + printk(KERN_ERR "%s: class_device_register failed\n", + __FUNCTION__); + kfree(&vfd->class_dev); + return ret; + } video_device_create_file(vfd, &class_device_attr_name); #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,12) video_device_create_file(vfd, &class_device_attr_dev); |