File tree Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -730,6 +730,7 @@ int regmap_add_irq_chip_fwnode(struct fwnode_handle *fwnode,
730
730
int i ;
731
731
int ret = - ENOMEM ;
732
732
int num_type_reg ;
733
+ int num_regs ;
733
734
u32 reg ;
734
735
735
736
if (chip -> num_regs <= 0 )
@@ -804,14 +805,20 @@ int regmap_add_irq_chip_fwnode(struct fwnode_handle *fwnode,
804
805
goto err_alloc ;
805
806
}
806
807
807
- num_type_reg = chip -> type_in_mask ? chip -> num_regs : chip -> num_type_reg ;
808
- if (num_type_reg ) {
809
- d -> type_buf_def = kcalloc (num_type_reg ,
808
+ /*
809
+ * Use num_config_regs if defined, otherwise fall back to num_type_reg
810
+ * to maintain backward compatibility.
811
+ */
812
+ num_type_reg = chip -> num_config_regs ? chip -> num_config_regs
813
+ : chip -> num_type_reg ;
814
+ num_regs = chip -> type_in_mask ? chip -> num_regs : num_type_reg ;
815
+ if (num_regs ) {
816
+ d -> type_buf_def = kcalloc (num_regs ,
810
817
sizeof (* d -> type_buf_def ), GFP_KERNEL );
811
818
if (!d -> type_buf_def )
812
819
goto err_alloc ;
813
820
814
- d -> type_buf = kcalloc (num_type_reg , sizeof (* d -> type_buf ),
821
+ d -> type_buf = kcalloc (num_regs , sizeof (* d -> type_buf ),
815
822
GFP_KERNEL );
816
823
if (!d -> type_buf )
817
824
goto err_alloc ;
You can’t perform that action at this time.
0 commit comments