File tree Expand file tree Collapse file tree 1 file changed +9
-8
lines changed Expand file tree Collapse file tree 1 file changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -490,26 +490,21 @@ static int __init kxo_init(void)
490490 ret = device_create_file (kxo_dev , & dev_attr_kxo_state );
491491 if (ret < 0 ) {
492492 printk (KERN_ERR "failed to create sysfs file kxo_state\n" );
493- goto error_cdev ;
493+ goto error_device ;
494494 }
495495
496496 /* Allocate fast circular buffer */
497497 fast_buf .buf = vmalloc (PAGE_SIZE );
498498 if (!fast_buf .buf ) {
499- device_destroy (kxo_class , dev_id );
500- class_destroy (kxo_class );
501499 ret = - ENOMEM ;
502- goto error_cdev ;
500+ goto error_vmalloc ;
503501 }
504502
505503 /* Create the workqueue */
506504 kxo_workqueue = alloc_workqueue ("kxod" , WQ_UNBOUND , WQ_MAX_ACTIVE );
507505 if (!kxo_workqueue ) {
508- vfree (fast_buf .buf );
509- device_destroy (kxo_class , dev_id );
510- class_destroy (kxo_class );
511506 ret = - ENOMEM ;
512- goto error_cdev ;
507+ goto error_workqueue ;
513508 }
514509
515510 negamax_init ();
@@ -529,6 +524,12 @@ static int __init kxo_init(void)
529524 pr_info ("kxo: registered new kxo device: %d,%d\n" , major , 0 );
530525out :
531526 return ret ;
527+ error_workqueue :
528+ vfree (fast_buf .buf );
529+ error_vmalloc :
530+ device_destroy (kxo_class , dev_id );
531+ error_device :
532+ class_destroy (kxo_class );
532533error_cdev :
533534 cdev_del (& kxo_cdev );
534535error_region :
You can’t perform that action at this time.
0 commit comments