File tree Expand file tree Collapse file tree 1 file changed +15
-9
lines changed Expand file tree Collapse file tree 1 file changed +15
-9
lines changed Original file line number Diff line number Diff line change @@ -602,28 +602,34 @@ static struct idxd_device *idxd_alloc(struct pci_dev *pdev, struct idxd_driver_d
602
602
idxd_dev_set_type (& idxd -> idxd_dev , idxd -> data -> type );
603
603
idxd -> id = ida_alloc (& idxd_ida , GFP_KERNEL );
604
604
if (idxd -> id < 0 )
605
- return NULL ;
605
+ goto err_ida ;
606
606
607
607
idxd -> opcap_bmap = bitmap_zalloc_node (IDXD_MAX_OPCAP_BITS , GFP_KERNEL , dev_to_node (dev ));
608
- if (!idxd -> opcap_bmap ) {
609
- ida_free (& idxd_ida , idxd -> id );
610
- return NULL ;
611
- }
608
+ if (!idxd -> opcap_bmap )
609
+ goto err_opcap ;
612
610
613
611
device_initialize (conf_dev );
614
612
conf_dev -> parent = dev ;
615
613
conf_dev -> bus = & dsa_bus_type ;
616
614
conf_dev -> type = idxd -> data -> dev_type ;
617
615
rc = dev_set_name (conf_dev , "%s%d" , idxd -> data -> name_prefix , idxd -> id );
618
- if (rc < 0 ) {
619
- put_device (conf_dev );
620
- return NULL ;
621
- }
616
+ if (rc < 0 )
617
+ goto err_name ;
622
618
623
619
spin_lock_init (& idxd -> dev_lock );
624
620
spin_lock_init (& idxd -> cmd_lock );
625
621
626
622
return idxd ;
623
+
624
+ err_name :
625
+ put_device (conf_dev );
626
+ bitmap_free (idxd -> opcap_bmap );
627
+ err_opcap :
628
+ ida_free (& idxd_ida , idxd -> id );
629
+ err_ida :
630
+ kfree (idxd );
631
+
632
+ return NULL ;
627
633
}
628
634
629
635
static int idxd_enable_system_pasid (struct idxd_device * idxd )
You can’t perform that action at this time.
0 commit comments