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 @@ -488,26 +488,21 @@ static int __init kxo_init(void)
488488 ret = device_create_file (kxo_dev , & dev_attr_kxo_state );
489489 if (ret < 0 ) {
490490 printk (KERN_ERR "failed to create sysfs file kxo_state\n" );
491- goto error_cdev ;
491+ goto error_device ;
492492 }
493493
494494 /* Allocate fast circular buffer */
495495 fast_buf .buf = vmalloc (PAGE_SIZE );
496496 if (!fast_buf .buf ) {
497- device_destroy (kxo_class , dev_id );
498- class_destroy (kxo_class );
499497 ret = - ENOMEM ;
500- goto error_cdev ;
498+ goto error_vmalloc ;
501499 }
502500
503501 /* Create the workqueue */
504502 kxo_workqueue = alloc_workqueue ("kxod" , WQ_UNBOUND , WQ_MAX_ACTIVE );
505503 if (!kxo_workqueue ) {
506- vfree (fast_buf .buf );
507- device_destroy (kxo_class , dev_id );
508- class_destroy (kxo_class );
509504 ret = - ENOMEM ;
510- goto error_cdev ;
505+ goto error_workqueue ;
511506 }
512507
513508 negamax_init ();
@@ -527,6 +522,12 @@ static int __init kxo_init(void)
527522 pr_info ("kxo: registered new kxo device: %d,%d\n" , major , 0 );
528523out :
529524 return ret ;
525+ error_workqueue :
526+ vfree (fast_buf .buf );
527+ error_vmalloc :
528+ device_destroy (kxo_class , dev_id );
529+ error_device :
530+ class_destroy (kxo_class );
530531error_cdev :
531532 cdev_del (& kxo_cdev );
532533error_region :
You can’t perform that action at this time.
0 commit comments