if (rc) {
dev_warn(endpoint->dev, "Failed to obtain major/minors");
- goto error1;
+ return rc;
}
endpoint->major = major = MAJOR(dev);
endpoint->num_channels);
if (rc) {
dev_warn(endpoint->dev, "Failed to add cdev. Aborting.\n");
- goto error2;
+ goto unregister_chrdev;
}
idt++;
dev_warn(endpoint->dev,
"Failed to create %s device. Aborting.\n",
devname);
- goto error3;
+ rc = -ENODEV;
+ goto unroll_device_create;
}
}
endpoint->num_channels);
return 0; /* succeed */
-error3:
+unroll_device_create:
devnum--; i--;
for (; devnum >= 0; devnum--, i--)
device_destroy(xillybus_class, MKDEV(major, i));
cdev_del(&endpoint->cdev);
-error2:
+unregister_chrdev:
unregister_chrdev_region(MKDEV(major, minor), endpoint->num_channels);
-error1:
return rc;
}