Commit 707a306c authored by Ben Collins's avatar Ben Collins

IEEE1394(r1162): Check return value for errors from hpsb_register_protocol.

parent e07f4d38
......@@ -2610,24 +2610,32 @@ static void __exit dv1394_exit_module(void)
static int __init dv1394_init_module(void)
{
int ret;
cdev_init(&dv1394_cdev, &dv1394_fops);
dv1394_cdev.owner = THIS_MODULE;
kobject_set_name(&dv1394_cdev.kobj, "dv1394");
if (cdev_add(&dv1394_cdev, IEEE1394_DV1394_DEV, 16)) {
ret = cdev_add(&dv1394_cdev, IEEE1394_DV1394_DEV, 16);
if (ret) {
printk(KERN_ERR "dv1394: unable to register character device\n");
return -EIO;
return ret;
}
devfs_mk_dir("ieee1394/dv");
hpsb_register_highlevel(&dv1394_highlevel);
hpsb_register_protocol(&dv1394_driver);
ret = hpsb_register_protocol(&dv1394_driver);
if (ret) {
printk(KERN_ERR "dv1394: failed to register protocol\n");
hpsb_unregister_highlevel(&dv1394_highlevel);
devfs_remove("ieee1394/dv");
cdev_del(&dv1394_cdev);
return ret;
}
#ifdef CONFIG_COMPAT
{
int ret;
/* First compatible ones */
ret = register_ioctl32_conversion(DV1394_IOC_SHUTDOWN, NULL);
ret |= register_ioctl32_conversion(DV1394_IOC_SUBMIT_FRAMES, NULL);
......
......@@ -2737,6 +2737,8 @@ static struct file_operations raw1394_fops = {
static int __init init_raw1394(void)
{
int ret;
hpsb_register_highlevel(&raw1394_highlevel);
devfs_mk_cdev(MKDEV(IEEE1394_MAJOR, IEEE1394_MINOR_BLOCK_RAW1394 * 16),
......@@ -2745,16 +2747,24 @@ static int __init init_raw1394(void)
cdev_init(&raw1394_cdev, &raw1394_fops);
raw1394_cdev.owner = THIS_MODULE;
kobject_set_name(&raw1394_cdev.kobj, RAW1394_DEVICE_NAME);
if (cdev_add(&raw1394_cdev, IEEE1394_RAW1394_DEV, 1)) {
ret = cdev_add(&raw1394_cdev, IEEE1394_RAW1394_DEV, 1);
if (ret) {
HPSB_ERR("raw1394 failed to register minor device block");
devfs_remove(RAW1394_DEVICE_NAME);
hpsb_unregister_highlevel(&raw1394_highlevel);
return -EBUSY;
return ret;
}
printk(KERN_INFO "raw1394: /dev/%s device initialized\n", RAW1394_DEVICE_NAME);
HPSB_INFO("raw1394: /dev/%s device initialized", RAW1394_DEVICE_NAME);
hpsb_register_protocol(&raw1394_driver);
ret = hpsb_register_protocol(&raw1394_driver);
if (ret) {
HPSB_ERR("raw1394: failed to register protocol");
cdev_del(&raw1394_cdev);
devfs_remove(RAW1394_DEVICE_NAME);
hpsb_unregister_highlevel(&raw1394_highlevel);
return ret;
}
return 0;
}
......
......@@ -2801,6 +2801,8 @@ static Scsi_Host_Template scsi_driver_template = {
static int sbp2_module_init(void)
{
int ret;
SBP2_DEBUG("sbp2_module_init");
printk(KERN_INFO "sbp2: %s\n", version);
......@@ -2819,7 +2821,12 @@ static int sbp2_module_init(void)
/* Register our high level driver with 1394 stack */
hpsb_register_highlevel(&sbp2_highlevel);
hpsb_register_protocol(&sbp2_driver);
ret = hpsb_register_protocol(&sbp2_driver);
if (ret) {
SBP2_ERR("Failed to register protocol");
hpsb_unregister_highlevel(&sbp2_highlevel);
return ret;
}
return 0;
}
......
......@@ -1453,24 +1453,32 @@ static void __exit video1394_exit_module (void)
static int __init video1394_init_module (void)
{
int ret;
cdev_init(&video1394_cdev, &video1394_fops);
video1394_cdev.owner = THIS_MODULE;
kobject_set_name(&video1394_cdev.kobj, VIDEO1394_DRIVER_NAME);
ret = cdev_add(&video1394_cdev, IEEE1394_VIDEO1394_DEV, 16);
if (cdev_add(&video1394_cdev, IEEE1394_VIDEO1394_DEV, 16)) {
PRINT_G(KERN_ERR, "video1394: unable to get minor device block");
return -EIO;
return ret;
}
devfs_mk_dir(VIDEO1394_DRIVER_NAME);
hpsb_register_highlevel(&video1394_highlevel);
hpsb_register_protocol(&video1394_driver);
ret = hpsb_register_protocol(&video1394_driver);
if (ret) {
PRINT_G(KERN_ERR, "video1394: failed to register protocol");
hpsb_unregister_highlevel(&video1394_highlevel);
devfs_remove(VIDEO1394_DRIVER_NAME);
cdev_del(&video1394_cdev);
return ret;
}
#ifdef CONFIG_COMPAT
{
int ret;
/* First the compatible ones */
ret = register_ioctl32_conversion(VIDEO1394_IOC_LISTEN_CHANNEL, NULL);
ret |= register_ioctl32_conversion(VIDEO1394_IOC_UNLISTEN_CHANNEL, NULL);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment