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