diff options
author | Michael Krufky <mkrufky@linuxtv.org> | 2006-07-18 16:17:56 -0300 |
---|---|---|
committer | Michael Krufky <mkrufky@linuxtv.org> | 2006-07-18 16:17:56 -0300 |
commit | 06a3e0dc829a015ef4b76d4e016df13b0be89e46 (patch) | |
tree | 65ab85f438dd5d116d3c36df715995dc9d9f18ab /linux/drivers/media/video/pvrusb2/pvrusb2-sysfs.c | |
parent | a51dd4ea79a5c23d0a701ec0cffb8fe7e190e2b8 (diff) | |
download | mediapointer-dvb-s2-06a3e0dc829a015ef4b76d4e016df13b0be89e46.tar.gz mediapointer-dvb-s2-06a3e0dc829a015ef4b76d4e016df13b0be89e46.tar.bz2 |
pvrusb2: 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(class_dev) and return.
Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
Diffstat (limited to 'linux/drivers/media/video/pvrusb2/pvrusb2-sysfs.c')
-rw-r--r-- | linux/drivers/media/video/pvrusb2/pvrusb2-sysfs.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/linux/drivers/media/video/pvrusb2/pvrusb2-sysfs.c b/linux/drivers/media/video/pvrusb2/pvrusb2-sysfs.c index 4770bc3be..045f2d585 100644 --- a/linux/drivers/media/video/pvrusb2/pvrusb2-sysfs.c +++ b/linux/drivers/media/video/pvrusb2/pvrusb2-sysfs.c @@ -710,6 +710,8 @@ static void class_dev_create(struct pvr2_sysfs *sfp, { struct usb_device *usb_dev; struct class_device *class_dev; + int ret; + usb_dev = pvr2_hdw_get_dev(sfp->channel.hdw); if (!usb_dev) return; class_dev = kmalloc(sizeof(*class_dev),GFP_KERNEL); @@ -734,7 +736,13 @@ static void class_dev_create(struct pvr2_sysfs *sfp, sfp->class_dev = class_dev; class_dev->class_data = sfp; - class_device_register(class_dev); + ret = class_device_register(class_dev); + if (ret) { + printk(KERN_ERR "%s: class_device_register failed\n", + __FUNCTION__); + kfree(class_dev); + return; + } sfp->attr_v4l_minor_number.attr.owner = THIS_MODULE; sfp->attr_v4l_minor_number.attr.name = "v4l_minor_number"; |