aboutsummaryrefslogtreecommitdiffstats
path: root/net/irda/irda_device.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/irda/irda_device.c')
-rw-r--r--net/irda/irda_device.c21
1 files changed, 8 insertions, 13 deletions
diff --git a/net/irda/irda_device.c b/net/irda/irda_device.c
index e717801b38f9..7b5def1ea633 100644
--- a/net/irda/irda_device.c
+++ b/net/irda/irda_device.c
@@ -375,7 +375,7 @@ EXPORT_SYMBOL(alloc_irdadev);
375dongle_t *irda_device_dongle_init(struct net_device *dev, int type) 375dongle_t *irda_device_dongle_init(struct net_device *dev, int type)
376{ 376{
377 struct dongle_reg *reg; 377 struct dongle_reg *reg;
378 dongle_t *dongle = NULL; 378 dongle_t *dongle = kzalloc(sizeof(dongle_t), GFP_KERNEL);
379 379
380 might_sleep(); 380 might_sleep();
381 381
@@ -397,19 +397,14 @@ dongle_t *irda_device_dongle_init(struct net_device *dev, int type)
397 if (!reg || !try_module_get(reg->owner) ) { 397 if (!reg || !try_module_get(reg->owner) ) {
398 IRDA_ERROR("IrDA: Unable to find requested dongle type %x\n", 398 IRDA_ERROR("IrDA: Unable to find requested dongle type %x\n",
399 type); 399 type);
400 goto out; 400 kfree(dongle);
401 dongle = NULL;
402 }
403 if (dongle) {
404 /* Bind the registration info to this particular instance */
405 dongle->issue = reg;
406 dongle->dev = dev;
401 } 407 }
402
403 /* Allocate dongle info for this instance */
404 dongle = kzalloc(sizeof(dongle_t), GFP_KERNEL);
405 if (!dongle)
406 goto out;
407
408 /* Bind the registration info to this particular instance */
409 dongle->issue = reg;
410 dongle->dev = dev;
411
412 out:
413 spin_unlock(&dongles->hb_spinlock); 408 spin_unlock(&dongles->hb_spinlock);
414 return dongle; 409 return dongle;
415} 410}