aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390/net/fsm.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/s390/net/fsm.c')
-rw-r--r--drivers/s390/net/fsm.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/drivers/s390/net/fsm.c b/drivers/s390/net/fsm.c
index 6caf5fa6a3b5..7145e2134cf0 100644
--- a/drivers/s390/net/fsm.c
+++ b/drivers/s390/net/fsm.c
@@ -21,38 +21,34 @@ init_fsm(char *name, const char **state_names, const char **event_names, int nr_
21 fsm_function_t *m; 21 fsm_function_t *m;
22 fsm *f; 22 fsm *f;
23 23
24 this = (fsm_instance *)kmalloc(sizeof(fsm_instance), order); 24 this = kzalloc(sizeof(fsm_instance), order);
25 if (this == NULL) { 25 if (this == NULL) {
26 printk(KERN_WARNING 26 printk(KERN_WARNING
27 "fsm(%s): init_fsm: Couldn't alloc instance\n", name); 27 "fsm(%s): init_fsm: Couldn't alloc instance\n", name);
28 return NULL; 28 return NULL;
29 } 29 }
30 memset(this, 0, sizeof(fsm_instance));
31 strlcpy(this->name, name, sizeof(this->name)); 30 strlcpy(this->name, name, sizeof(this->name));
32 31
33 f = (fsm *)kmalloc(sizeof(fsm), order); 32 f = kzalloc(sizeof(fsm), order);
34 if (f == NULL) { 33 if (f == NULL) {
35 printk(KERN_WARNING 34 printk(KERN_WARNING
36 "fsm(%s): init_fsm: Couldn't alloc fsm\n", name); 35 "fsm(%s): init_fsm: Couldn't alloc fsm\n", name);
37 kfree_fsm(this); 36 kfree_fsm(this);
38 return NULL; 37 return NULL;
39 } 38 }
40 memset(f, 0, sizeof(fsm));
41 f->nr_events = nr_events; 39 f->nr_events = nr_events;
42 f->nr_states = nr_states; 40 f->nr_states = nr_states;
43 f->event_names = event_names; 41 f->event_names = event_names;
44 f->state_names = state_names; 42 f->state_names = state_names;
45 this->f = f; 43 this->f = f;
46 44
47 m = (fsm_function_t *)kmalloc( 45 m = kcalloc(nr_states*nr_events, sizeof(fsm_function_t), order);
48 sizeof(fsm_function_t) * nr_states * nr_events, order);
49 if (m == NULL) { 46 if (m == NULL) {
50 printk(KERN_WARNING 47 printk(KERN_WARNING
51 "fsm(%s): init_fsm: Couldn't alloc jumptable\n", name); 48 "fsm(%s): init_fsm: Couldn't alloc jumptable\n", name);
52 kfree_fsm(this); 49 kfree_fsm(this);
53 return NULL; 50 return NULL;
54 } 51 }
55 memset(m, 0, sizeof(fsm_function_t) * f->nr_states * f->nr_events);
56 f->jumpmatrix = m; 52 f->jumpmatrix = m;
57 53
58 for (i = 0; i < tmpl_len; i++) { 54 for (i = 0; i < tmpl_len; i++) {