in tee_core.c [1228:1259]
static int __init tee_init(void)
{
int rc;
tee_class = class_create(THIS_MODULE, "tee");
if (IS_ERR(tee_class)) {
pr_err("couldn't create class\n");
return PTR_ERR(tee_class);
}
rc = alloc_chrdev_region(&tee_devt, 0, TEE_NUM_DEVICES, "tee");
if (rc) {
pr_err("failed to allocate char dev region\n");
goto out_unreg_class;
}
rc = bus_register(&tee_bus_type);
if (rc) {
pr_err("failed to register tee bus\n");
goto out_unreg_chrdev;
}
return 0;
out_unreg_chrdev:
unregister_chrdev_region(tee_devt, TEE_NUM_DEVICES);
out_unreg_class:
class_destroy(tee_class);
tee_class = NULL;
return rc;
}