diff options
Diffstat (limited to 'net/irda/irttp.c')
| -rw-r--r-- | net/irda/irttp.c | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/net/irda/irttp.c b/net/irda/irttp.c index 6602d901f8b1..8aff254cb418 100644 --- a/net/irda/irttp.c +++ b/net/irda/irttp.c | |||
| @@ -38,7 +38,7 @@ | |||
| 38 | #include <net/irda/parameters.h> | 38 | #include <net/irda/parameters.h> |
| 39 | #include <net/irda/irttp.h> | 39 | #include <net/irda/irttp.h> |
| 40 | 40 | ||
| 41 | static struct irttp_cb *irttp = NULL; | 41 | static struct irttp_cb *irttp; |
| 42 | 42 | ||
| 43 | static void __irttp_close_tsap(struct tsap_cb *self); | 43 | static void __irttp_close_tsap(struct tsap_cb *self); |
| 44 | 44 | ||
| @@ -86,12 +86,9 @@ static pi_param_info_t param_info = { pi_major_call_table, 1, 0x0f, 4 }; | |||
| 86 | */ | 86 | */ |
| 87 | int __init irttp_init(void) | 87 | int __init irttp_init(void) |
| 88 | { | 88 | { |
| 89 | /* Initialize the irttp structure. */ | 89 | irttp = kmalloc(sizeof(struct irttp_cb), GFP_KERNEL); |
| 90 | if (irttp == NULL) { | 90 | if (irttp == NULL) |
| 91 | irttp = kmalloc(sizeof(struct irttp_cb), GFP_KERNEL); | 91 | return -ENOMEM; |
| 92 | if (irttp == NULL) | ||
| 93 | return -ENOMEM; | ||
| 94 | } | ||
| 95 | memset(irttp, 0, sizeof(struct irttp_cb)); | 92 | memset(irttp, 0, sizeof(struct irttp_cb)); |
| 96 | 93 | ||
| 97 | irttp->magic = TTP_MAGIC; | 94 | irttp->magic = TTP_MAGIC; |
| @@ -100,6 +97,7 @@ int __init irttp_init(void) | |||
| 100 | if (!irttp->tsaps) { | 97 | if (!irttp->tsaps) { |
| 101 | IRDA_ERROR("%s: can't allocate IrTTP hashbin!\n", | 98 | IRDA_ERROR("%s: can't allocate IrTTP hashbin!\n", |
| 102 | __FUNCTION__); | 99 | __FUNCTION__); |
| 100 | kfree(irttp); | ||
| 103 | return -ENOMEM; | 101 | return -ENOMEM; |
| 104 | } | 102 | } |
| 105 | 103 | ||
| @@ -115,7 +113,6 @@ int __init irttp_init(void) | |||
| 115 | void __exit irttp_cleanup(void) | 113 | void __exit irttp_cleanup(void) |
| 116 | { | 114 | { |
| 117 | /* Check for main structure */ | 115 | /* Check for main structure */ |
| 118 | IRDA_ASSERT(irttp != NULL, return;); | ||
| 119 | IRDA_ASSERT(irttp->magic == TTP_MAGIC, return;); | 116 | IRDA_ASSERT(irttp->magic == TTP_MAGIC, return;); |
| 120 | 117 | ||
| 121 | /* | 118 | /* |
| @@ -382,7 +379,6 @@ struct tsap_cb *irttp_open_tsap(__u8 stsap_sel, int credit, notify_t *notify) | |||
| 382 | struct lsap_cb *lsap; | 379 | struct lsap_cb *lsap; |
| 383 | notify_t ttp_notify; | 380 | notify_t ttp_notify; |
| 384 | 381 | ||
| 385 | IRDA_ASSERT(irttp != NULL, return NULL;); | ||
| 386 | IRDA_ASSERT(irttp->magic == TTP_MAGIC, return NULL;); | 382 | IRDA_ASSERT(irttp->magic == TTP_MAGIC, return NULL;); |
| 387 | 383 | ||
| 388 | /* The IrLMP spec (IrLMP 1.1 p10) says that we have the right to | 384 | /* The IrLMP spec (IrLMP 1.1 p10) says that we have the right to |
| @@ -1880,8 +1876,6 @@ static int irttp_seq_open(struct inode *inode, struct file *file) | |||
| 1880 | struct seq_file *seq; | 1876 | struct seq_file *seq; |
| 1881 | int rc = -ENOMEM; | 1877 | int rc = -ENOMEM; |
| 1882 | struct irttp_iter_state *s; | 1878 | struct irttp_iter_state *s; |
| 1883 | |||
| 1884 | IRDA_ASSERT(irttp != NULL, return -EINVAL;); | ||
| 1885 | 1879 | ||
| 1886 | s = kmalloc(sizeof(*s), GFP_KERNEL); | 1880 | s = kmalloc(sizeof(*s), GFP_KERNEL); |
| 1887 | if (!s) | 1881 | if (!s) |
