[module] add logging for kvmfr_module_init

This commit is contained in:
MakiseKurisu 2023-04-16 13:11:55 +08:00 committed by Geoffrey McRae
parent 063a859de1
commit 9d5c543a53

View File

@ -557,25 +557,39 @@ static int __init kvmfr_module_init(void)
int ret; int ret;
kvmfr = kzalloc(sizeof(struct kvmfr_info), GFP_KERNEL); kvmfr = kzalloc(sizeof(struct kvmfr_info), GFP_KERNEL);
if (!kvmfr) if (!kvmfr) {
printk(KERN_INFO "kvmfr: kvmfr_module_init: failed to allocate memory!\n");
return -ENOMEM; return -ENOMEM;
}
kvmfr->major = register_chrdev(0, KVMFR_DEV_NAME, &fops); kvmfr->major = register_chrdev(0, KVMFR_DEV_NAME, &fops);
if (kvmfr->major < 0) if (kvmfr->major < 0) {
printk(
KERN_INFO "kvmfr: kvmfr_module_init: failed to register char device!\n");
goto out_free; goto out_free;
}
kvmfr->pClass = class_create(THIS_MODULE, KVMFR_DEV_NAME); kvmfr->pClass = class_create(THIS_MODULE, KVMFR_DEV_NAME);
if (IS_ERR(kvmfr->pClass)) if (IS_ERR(kvmfr->pClass)) {
printk(KERN_INFO "kvmfr: kvmfr_module_init: failed to create class!\n");
goto out_unreg; goto out_unreg;
}
ret = create_static_devices(); ret = create_static_devices();
if (ret < 0) if (ret < 0) {
printk(
KERN_INFO "kvmfr: kvmfr_module_init: failed to create static devices!\n");
goto out_class_destroy; goto out_class_destroy;
}
ret = pci_register_driver(&kvmfr_pci_driver); ret = pci_register_driver(&kvmfr_pci_driver);
if (ret < 0) if (ret < 0) {
printk(
KERN_INFO "kvmfr: kvmfr_module_init: failed to register pci driver!\n");
goto out_free_static; goto out_free_static;
}
printk(KERN_INFO "kvmfr: kvmfr_module_init: module loaded\n");
return 0; return 0;
out_free_static: out_free_static: