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/media | |
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/media')
-rw-r--r-- | drivers/media/dvb/frontends/nxt200x.c | 4 | ||||
-rw-r--r-- | drivers/media/dvb/frontends/or51211.c | 2 | ||||
-rw-r--r-- | drivers/media/dvb/frontends/sp8870.c | 2 | ||||
-rw-r--r-- | drivers/media/dvb/frontends/sp887x.c | 2 | ||||
-rw-r--r-- | drivers/media/video/cx88/cx88-blackbird.c | 3 |
5 files changed, 8 insertions, 5 deletions
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); |