aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--net/irda/irlan/irlan_common.c23
1 files changed, 20 insertions, 3 deletions
diff --git a/net/irda/irlan/irlan_common.c b/net/irda/irlan/irlan_common.c
index 2bb04ac09329..310776dd6109 100644
--- a/net/irda/irlan/irlan_common.c
+++ b/net/irda/irlan/irlan_common.c
@@ -144,12 +144,18 @@ static int __init irlan_init(void)
144 /* Register with IrLMP as a client */ 144 /* Register with IrLMP as a client */
145 ckey = irlmp_register_client(hints, &irlan_client_discovery_indication, 145 ckey = irlmp_register_client(hints, &irlan_client_discovery_indication,
146 NULL, NULL); 146 NULL, NULL);
147 147 if (!ckey)
148 goto err_ckey;
149
148 /* Register with IrLMP as a service */ 150 /* Register with IrLMP as a service */
149 skey = irlmp_register_service(hints); 151 skey = irlmp_register_service(hints);
152 if (!skey)
153 goto err_skey;
150 154
151 /* Start the master IrLAN instance (the only one for now) */ 155 /* Start the master IrLAN instance (the only one for now) */
152 new = irlan_open(DEV_ADDR_ANY, DEV_ADDR_ANY); 156 new = irlan_open(DEV_ADDR_ANY, DEV_ADDR_ANY);
157 if (!new)
158 goto err_open;
153 159
154 /* The master will only open its (listen) control TSAP */ 160 /* The master will only open its (listen) control TSAP */
155 irlan_provider_open_ctrl_tsap(new); 161 irlan_provider_open_ctrl_tsap(new);
@@ -158,6 +164,17 @@ static int __init irlan_init(void)
158 irlmp_discovery_request(DISCOVERY_DEFAULT_SLOTS); 164 irlmp_discovery_request(DISCOVERY_DEFAULT_SLOTS);
159 165
160 return 0; 166 return 0;
167
168err_open:
169 irlmp_unregister_service(skey);
170err_skey:
171 irlmp_unregister_client(ckey);
172err_ckey:
173#ifdef CONFIG_PROC_FS
174 remove_proc_entry("irlan", proc_irda);
175#endif /* CONFIG_PROC_FS */
176
177 return -ENOMEM;
161} 178}
162 179
163static void __exit irlan_cleanup(void) 180static void __exit irlan_cleanup(void)