aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/bluetooth/bcm203x.c1
-rw-r--r--drivers/media/dvb/frontends/nxt200x.c4
-rw-r--r--drivers/media/dvb/frontends/or51211.c2
-rw-r--r--drivers/media/dvb/frontends/sp8870.c2
-rw-r--r--drivers/media/dvb/frontends/sp887x.c2
-rw-r--r--drivers/media/video/cx88/cx88-blackbird.c3
-rw-r--r--drivers/net/wireless/spectrum_cs.c37
7 files changed, 25 insertions, 26 deletions
diff --git a/drivers/bluetooth/bcm203x.c b/drivers/bluetooth/bcm203x.c
index 6f67141f4de0..13ba729cdd57 100644
--- a/drivers/bluetooth/bcm203x.c
+++ b/drivers/bluetooth/bcm203x.c
@@ -234,6 +234,7 @@ static int bcm203x_probe(struct usb_interface *intf, const struct usb_device_id
234 data->fw_data = kmalloc(firmware->size, GFP_KERNEL); 234 data->fw_data = kmalloc(firmware->size, GFP_KERNEL);
235 if (!data->fw_data) { 235 if (!data->fw_data) {
236 BT_ERR("Can't allocate memory for firmware image"); 236 BT_ERR("Can't allocate memory for firmware image");
237 release_firmware(firmware);
237 usb_free_urb(data->urb); 238 usb_free_urb(data->urb);
238 kfree(data->buffer); 239 kfree(data->buffer);
239 kfree(data); 240 kfree(data);
diff --git a/drivers/media/dvb/frontends/nxt200x.c b/drivers/media/dvb/frontends/nxt200x.c
index 55671cb5255e..87c286ee6a00 100644
--- a/drivers/media/dvb/frontends/nxt200x.c
+++ b/drivers/media/dvb/frontends/nxt200x.c
@@ -896,9 +896,9 @@ static int nxt2002_init(struct dvb_frontend* fe)
896 } 896 }
897 897
898 ret = nxt2002_load_firmware(fe, fw); 898 ret = nxt2002_load_firmware(fe, fw);
899 release_firmware(fw);
899 if (ret) { 900 if (ret) {
900 printk("nxt2002: Writing firmware to device failed\n"); 901 printk("nxt2002: Writing firmware to device failed\n");
901 release_firmware(fw);
902 return ret; 902 return ret;
903 } 903 }
904 printk("nxt2002: Firmware upload complete\n"); 904 printk("nxt2002: Firmware upload complete\n");
@@ -960,9 +960,9 @@ static int nxt2004_init(struct dvb_frontend* fe)
960 } 960 }
961 961
962 ret = nxt2004_load_firmware(fe, fw); 962 ret = nxt2004_load_firmware(fe, fw);
963 release_firmware(fw);
963 if (ret) { 964 if (ret) {
964 printk("nxt2004: Writing firmware to device failed\n"); 965 printk("nxt2004: Writing firmware to device failed\n");
965 release_firmware(fw);
966 return ret; 966 return ret;
967 } 967 }
968 printk("nxt2004: Firmware upload complete\n"); 968 printk("nxt2004: Firmware upload complete\n");
diff --git a/drivers/media/dvb/frontends/or51211.c b/drivers/media/dvb/frontends/or51211.c
index 26bed616fabe..2bf124b53689 100644
--- a/drivers/media/dvb/frontends/or51211.c
+++ b/drivers/media/dvb/frontends/or51211.c
@@ -437,10 +437,10 @@ static int or51211_init(struct dvb_frontend* fe)
437 } 437 }
438 438
439 ret = or51211_load_firmware(fe, fw); 439 ret = or51211_load_firmware(fe, fw);
440 release_firmware(fw);
440 if (ret) { 441 if (ret) {
441 printk(KERN_WARNING "or51211: Writing firmware to " 442 printk(KERN_WARNING "or51211: Writing firmware to "
442 "device failed!\n"); 443 "device failed!\n");
443 release_firmware(fw);
444 return ret; 444 return ret;
445 } 445 }
446 printk(KERN_INFO "or51211: Firmware upload complete.\n"); 446 printk(KERN_INFO "or51211: Firmware upload complete.\n");
diff --git a/drivers/media/dvb/frontends/sp8870.c b/drivers/media/dvb/frontends/sp8870.c
index 44ec5b9a4695..d98fd5c2e13e 100644
--- a/drivers/media/dvb/frontends/sp8870.c
+++ b/drivers/media/dvb/frontends/sp8870.c
@@ -318,7 +318,6 @@ static int sp8870_init (struct dvb_frontend* fe)
318 printk("sp8870: waiting for firmware upload (%s)...\n", SP8870_DEFAULT_FIRMWARE); 318 printk("sp8870: waiting for firmware upload (%s)...\n", SP8870_DEFAULT_FIRMWARE);
319 if (state->config->request_firmware(fe, &fw, SP8870_DEFAULT_FIRMWARE)) { 319 if (state->config->request_firmware(fe, &fw, SP8870_DEFAULT_FIRMWARE)) {
320 printk("sp8870: no firmware upload (timeout or file not found?)\n"); 320 printk("sp8870: no firmware upload (timeout or file not found?)\n");
321 release_firmware(fw);
322 return -EIO; 321 return -EIO;
323 } 322 }
324 323
@@ -327,6 +326,7 @@ static int sp8870_init (struct dvb_frontend* fe)
327 release_firmware(fw); 326 release_firmware(fw);
328 return -EIO; 327 return -EIO;
329 } 328 }
329 release_firmware(fw);
330 printk("sp8870: firmware upload complete\n"); 330 printk("sp8870: firmware upload complete\n");
331 331
332 /* enable TS output and interface pins */ 332 /* enable TS output and interface pins */
diff --git a/drivers/media/dvb/frontends/sp887x.c b/drivers/media/dvb/frontends/sp887x.c
index b0a2b02f6608..5c2f8f4e0ae5 100644
--- a/drivers/media/dvb/frontends/sp887x.c
+++ b/drivers/media/dvb/frontends/sp887x.c
@@ -520,9 +520,9 @@ static int sp887x_init(struct dvb_frontend* fe)
520 } 520 }
521 521
522 ret = sp887x_initial_setup(fe, fw); 522 ret = sp887x_initial_setup(fe, fw);
523 release_firmware(fw);
523 if (ret) { 524 if (ret) {
524 printk("sp887x: writing firmware to device failed\n"); 525 printk("sp887x: writing firmware to device failed\n");
525 release_firmware(fw);
526 return ret; 526 return ret;
527 } 527 }
528 printk("sp887x: firmware upload complete\n"); 528 printk("sp887x: firmware upload complete\n");
diff --git a/drivers/media/video/cx88/cx88-blackbird.c b/drivers/media/video/cx88/cx88-blackbird.c
index 349632b48e93..b60177f173c3 100644
--- a/drivers/media/video/cx88/cx88-blackbird.c
+++ b/drivers/media/video/cx88/cx88-blackbird.c
@@ -453,11 +453,13 @@ static int blackbird_load_firmware(struct cx8802_dev *dev)
453 if (firmware->size != BLACKBIRD_FIRM_IMAGE_SIZE) { 453 if (firmware->size != BLACKBIRD_FIRM_IMAGE_SIZE) {
454 dprintk(0, "ERROR: Firmware size mismatch (have %zd, expected %d)\n", 454 dprintk(0, "ERROR: Firmware size mismatch (have %zd, expected %d)\n",
455 firmware->size, BLACKBIRD_FIRM_IMAGE_SIZE); 455 firmware->size, BLACKBIRD_FIRM_IMAGE_SIZE);
456 release_firmware(firmware);
456 return -1; 457 return -1;
457 } 458 }
458 459
459 if (0 != memcmp(firmware->data, magic, 8)) { 460 if (0 != memcmp(firmware->data, magic, 8)) {
460 dprintk(0, "ERROR: Firmware magic mismatch, wrong file?\n"); 461 dprintk(0, "ERROR: Firmware magic mismatch, wrong file?\n");
462 release_firmware(firmware);
461 return -1; 463 return -1;
462 } 464 }
463 465
@@ -478,6 +480,7 @@ static int blackbird_load_firmware(struct cx8802_dev *dev)
478 } 480 }
479 if (checksum) { 481 if (checksum) {
480 dprintk(0, "ERROR: Firmware load failed (checksum mismatch).\n"); 482 dprintk(0, "ERROR: Firmware load failed (checksum mismatch).\n");
483 release_firmware(firmware);
481 return -1; 484 return -1;
482 } 485 }
483 release_firmware(firmware); 486 release_firmware(firmware);
diff --git a/drivers/net/wireless/spectrum_cs.c b/drivers/net/wireless/spectrum_cs.c
index 15465278c789..7f78b7801fb3 100644
--- a/drivers/net/wireless/spectrum_cs.c
+++ b/drivers/net/wireless/spectrum_cs.c
@@ -34,8 +34,6 @@
34 34
35#include "orinoco.h" 35#include "orinoco.h"
36 36
37static unsigned char *primsym;
38static unsigned char *secsym;
39static const char primary_fw_name[] = "symbol_sp24t_prim_fw"; 37static const char primary_fw_name[] = "symbol_sp24t_prim_fw";
40static const char secondary_fw_name[] = "symbol_sp24t_sec_fw"; 38static const char secondary_fw_name[] = "symbol_sp24t_sec_fw";
41 39
@@ -440,7 +438,7 @@ spectrum_load_blocks(hermes_t *hw, const struct dblock *first_block)
440 */ 438 */
441static int 439static int
442spectrum_dl_image(hermes_t *hw, struct pcmcia_device *link, 440spectrum_dl_image(hermes_t *hw, struct pcmcia_device *link,
443 const unsigned char *image) 441 const unsigned char *image, int secondary)
444{ 442{
445 int ret; 443 int ret;
446 const unsigned char *ptr; 444 const unsigned char *ptr;
@@ -455,7 +453,7 @@ spectrum_dl_image(hermes_t *hw, struct pcmcia_device *link,
455 first_block = (const struct dblock *) ptr; 453 first_block = (const struct dblock *) ptr;
456 454
457 /* Read the PDA */ 455 /* Read the PDA */
458 if (image != primsym) { 456 if (secondary) {
459 ret = spectrum_read_pda(hw, pda, sizeof(pda)); 457 ret = spectrum_read_pda(hw, pda, sizeof(pda));
460 if (ret) 458 if (ret)
461 return ret; 459 return ret;
@@ -472,7 +470,7 @@ spectrum_dl_image(hermes_t *hw, struct pcmcia_device *link,
472 return ret; 470 return ret;
473 471
474 /* Write the PDA to the adapter */ 472 /* Write the PDA to the adapter */
475 if (image != primsym) { 473 if (secondary) {
476 ret = spectrum_apply_pda(hw, first_block, pda); 474 ret = spectrum_apply_pda(hw, first_block, pda);
477 if (ret) 475 if (ret)
478 return ret; 476 return ret;
@@ -487,7 +485,7 @@ spectrum_dl_image(hermes_t *hw, struct pcmcia_device *link,
487 ret = hermes_init(hw); 485 ret = hermes_init(hw);
488 486
489 /* hermes_reset() should return 0 with the secondary firmware */ 487 /* hermes_reset() should return 0 with the secondary firmware */
490 if (image != primsym && ret != 0) 488 if (secondary && ret != 0)
491 return -ENODEV; 489 return -ENODEV;
492 490
493 /* And this should work with any firmware */ 491 /* And this should work with any firmware */
@@ -509,33 +507,30 @@ spectrum_dl_firmware(hermes_t *hw, struct pcmcia_device *link)
509 const struct firmware *fw_entry; 507 const struct firmware *fw_entry;
510 508
511 if (request_firmware(&fw_entry, primary_fw_name, 509 if (request_firmware(&fw_entry, primary_fw_name,
512 &handle_to_dev(link)) == 0) { 510 &handle_to_dev(link)) != 0) {
513 primsym = fw_entry->data;
514 } else {
515 printk(KERN_ERR PFX "Cannot find firmware: %s\n", 511 printk(KERN_ERR PFX "Cannot find firmware: %s\n",
516 primary_fw_name); 512 primary_fw_name);
517 return -ENOENT; 513 return -ENOENT;
518 } 514 }
519 515
520 if (request_firmware(&fw_entry, secondary_fw_name,
521 &handle_to_dev(link)) == 0) {
522 secsym = fw_entry->data;
523 } else {
524 printk(KERN_ERR PFX "Cannot find firmware: %s\n",
525 secondary_fw_name);
526 return -ENOENT;
527 }
528
529 /* Load primary firmware */ 516 /* Load primary firmware */
530 ret = spectrum_dl_image(hw, link, primsym); 517 ret = spectrum_dl_image(hw, link, fw_entry->data, 0);
518 release_firmware(fw_entry);
531 if (ret) { 519 if (ret) {
532 printk(KERN_ERR PFX "Primary firmware download failed\n"); 520 printk(KERN_ERR PFX "Primary firmware download failed\n");
533 return ret; 521 return ret;
534 } 522 }
535 523
536 /* Load secondary firmware */ 524 if (request_firmware(&fw_entry, secondary_fw_name,
537 ret = spectrum_dl_image(hw, link, secsym); 525 &handle_to_dev(link)) != 0) {
526 printk(KERN_ERR PFX "Cannot find firmware: %s\n",
527 secondary_fw_name);
528 return -ENOENT;
529 }
538 530
531 /* Load secondary firmware */
532 ret = spectrum_dl_image(hw, link, fw_entry->data, 1);
533 release_firmware(fw_entry);
539 if (ret) { 534 if (ret) {
540 printk(KERN_ERR PFX "Secondary firmware download failed\n"); 535 printk(KERN_ERR PFX "Secondary firmware download failed\n");
541 } 536 }