File tree Expand file tree Collapse file tree 2 files changed +14
-17
lines changed Expand file tree Collapse file tree 2 files changed +14
-17
lines changed Original file line number Diff line number Diff line change @@ -71,19 +71,21 @@ static struct irq_desc irq_desc_init = {
71
71
72
72
void init_kstat_irqs (struct irq_desc * desc , int cpu , int nr )
73
73
{
74
- unsigned long bytes ;
75
- char * ptr ;
76
74
int node ;
77
-
78
- /* Compute how many bytes we need per irq and allocate them */
79
- bytes = nr * sizeof (unsigned int );
75
+ void * ptr ;
80
76
81
77
node = cpu_to_node (cpu );
82
- ptr = kzalloc_node (bytes , GFP_ATOMIC , node );
83
- printk (KERN_DEBUG " alloc kstat_irqs on cpu %d node %d\n" , cpu , node );
78
+ ptr = kzalloc_node (nr * sizeof (* desc -> kstat_irqs ), GFP_ATOMIC , node );
84
79
85
- if (ptr )
86
- desc -> kstat_irqs = (unsigned int * )ptr ;
80
+ /*
81
+ * don't overwite if can not get new one
82
+ * init_copy_kstat_irqs() could still use old one
83
+ */
84
+ if (ptr ) {
85
+ printk (KERN_DEBUG " alloc kstat_irqs on cpu %d node %d\n" ,
86
+ cpu , node );
87
+ desc -> kstat_irqs = ptr ;
88
+ }
87
89
}
88
90
89
91
static void init_one_irq_desc (int irq , struct irq_desc * desc , int cpu )
Original file line number Diff line number Diff line change @@ -17,16 +17,11 @@ static void init_copy_kstat_irqs(struct irq_desc *old_desc,
17
17
struct irq_desc * desc ,
18
18
int cpu , int nr )
19
19
{
20
- unsigned long bytes ;
21
-
22
20
init_kstat_irqs (desc , cpu , nr );
23
21
24
- if (desc -> kstat_irqs != old_desc -> kstat_irqs ) {
25
- /* Compute how many bytes we need per irq and allocate them */
26
- bytes = nr * sizeof (unsigned int );
27
-
28
- memcpy (desc -> kstat_irqs , old_desc -> kstat_irqs , bytes );
29
- }
22
+ if (desc -> kstat_irqs != old_desc -> kstat_irqs )
23
+ memcpy (desc -> kstat_irqs , old_desc -> kstat_irqs ,
24
+ nr * sizeof (* desc -> kstat_irqs ));
30
25
}
31
26
32
27
static void free_kstat_irqs (struct irq_desc * old_desc , struct irq_desc * desc )
You can’t perform that action at this time.
0 commit comments