diff options
author | Magnus Damm <magnus@valinux.co.jp> | 2006-07-10 07:44:09 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-07-10 16:24:15 -0400 |
commit | 73ca66b97b73257a7d832d502c36fc19fe847809 (patch) | |
tree | d39f50b1931d67c51e56f891b785be1143599177 /drivers/net/wireless/spectrum_cs.c | |
parent | 454d6fbc48374be8f53b9bafaa86530cf8eb3bc1 (diff) |
[PATCH] release_firmware() fixes
Use release_firmware() to free requested resources.
According to Documentation/firmware_class/README the request_firmware()
call should be followed by a release_firmware(). Some drivers do not
however free the firmware previously allocated with request_firmware().
This patch tries to fix this by making sure that release_firmware() is used
as expected.
Signed-off-by: Magnus Damm <magnus@valinux.co.jp>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Cc: Mauro Carvalho Chehab <mchehab@infradead.org>
Cc: "John W. Linville" <linville@tuxdriver.com>
Cc: Greg KH <greg@kroah.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/net/wireless/spectrum_cs.c')
-rw-r--r-- | drivers/net/wireless/spectrum_cs.c | 37 |
1 files changed, 16 insertions, 21 deletions
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 | ||
37 | static unsigned char *primsym; | ||
38 | static unsigned char *secsym; | ||
39 | static const char primary_fw_name[] = "symbol_sp24t_prim_fw"; | 37 | static const char primary_fw_name[] = "symbol_sp24t_prim_fw"; |
40 | static const char secondary_fw_name[] = "symbol_sp24t_sec_fw"; | 38 | static 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 | */ |
441 | static int | 439 | static int |
442 | spectrum_dl_image(hermes_t *hw, struct pcmcia_device *link, | 440 | spectrum_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 | } |