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,
730730 int i ;
731731 int ret = - ENOMEM ;
732732 int num_type_reg ;
733+ int num_regs ;
733734 u32 reg ;
734735
735736 if (chip -> num_regs <= 0 )
@@ -804,14 +805,20 @@ int regmap_add_irq_chip_fwnode(struct fwnode_handle *fwnode,
804805 goto err_alloc ;
805806 }
806807
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 ,
810817 sizeof (* d -> type_buf_def ), GFP_KERNEL );
811818 if (!d -> type_buf_def )
812819 goto err_alloc ;
813820
814- d -> type_buf = kcalloc (num_type_reg , sizeof (* d -> type_buf ),
821+ d -> type_buf = kcalloc (num_regs , sizeof (* d -> type_buf ),
815822 GFP_KERNEL );
816823 if (!d -> type_buf )
817824 goto err_alloc ;
You can’t perform that action at this time.
0 commit comments