Commit 0c744b01 authored by Anssi Hannula's avatar Anssi Hannula Committed by Linus Torvalds

[PATCH] dvb: add missing release_firmware() calls

Add missing release_firmware() calls to fix memory leaks.
Signed-off-by: default avatarAnssi Hannula <anssi.hannula@gmail.com>
Signed-off-by: default avatarJohannes Stezenbach <js@linuxtv.org>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 3faadbb0
...@@ -385,6 +385,7 @@ static int tda10045_fwupload(struct dvb_frontend* fe) ...@@ -385,6 +385,7 @@ static int tda10045_fwupload(struct dvb_frontend* fe)
tda10045h_set_bandwidth(state, BANDWIDTH_8_MHZ); tda10045h_set_bandwidth(state, BANDWIDTH_8_MHZ);
ret = tda1004x_do_upload(state, fw->data, fw->size, TDA10045H_FWPAGE, TDA10045H_CODE_IN); ret = tda1004x_do_upload(state, fw->data, fw->size, TDA10045H_FWPAGE, TDA10045H_CODE_IN);
release_firmware(fw);
if (ret) if (ret)
return ret; return ret;
printk(KERN_INFO "tda1004x: firmware upload complete\n"); printk(KERN_INFO "tda1004x: firmware upload complete\n");
...@@ -452,6 +453,7 @@ static int tda10046_fwupload(struct dvb_frontend* fe) ...@@ -452,6 +453,7 @@ static int tda10046_fwupload(struct dvb_frontend* fe)
} }
tda1004x_write_mask(state, TDA1004X_CONFC4, 8, 8); // going to boot from HOST tda1004x_write_mask(state, TDA1004X_CONFC4, 8, 8); // going to boot from HOST
ret = tda1004x_do_upload(state, fw->data, fw->size, TDA10046H_CODE_CPT, TDA10046H_CODE_IN); ret = tda1004x_do_upload(state, fw->data, fw->size, TDA10046H_CODE_CPT, TDA10046H_CODE_IN);
release_firmware(fw);
if (ret) if (ret)
return ret; return ret;
} else { } else {
......
...@@ -1281,6 +1281,7 @@ static int ttusb_dec_boot_dsp(struct ttusb_dec *dec) ...@@ -1281,6 +1281,7 @@ static int ttusb_dec_boot_dsp(struct ttusb_dec *dec)
if (firmware_size < 60) { if (firmware_size < 60) {
printk("%s: firmware size too small for DSP code (%zu < 60).\n", printk("%s: firmware size too small for DSP code (%zu < 60).\n",
__FUNCTION__, firmware_size); __FUNCTION__, firmware_size);
release_firmware(fw_entry);
return -1; return -1;
} }
...@@ -1294,6 +1295,7 @@ static int ttusb_dec_boot_dsp(struct ttusb_dec *dec) ...@@ -1294,6 +1295,7 @@ static int ttusb_dec_boot_dsp(struct ttusb_dec *dec)
printk("%s: crc32 check of DSP code failed (calculated " printk("%s: crc32 check of DSP code failed (calculated "
"0x%08x != 0x%08x in file), file invalid.\n", "0x%08x != 0x%08x in file), file invalid.\n",
__FUNCTION__, crc32_csum, crc32_check); __FUNCTION__, crc32_csum, crc32_check);
release_firmware(fw_entry);
return -1; return -1;
} }
memcpy(idstring, &firmware[36], 20); memcpy(idstring, &firmware[36], 20);
...@@ -1308,15 +1310,19 @@ static int ttusb_dec_boot_dsp(struct ttusb_dec *dec) ...@@ -1308,15 +1310,19 @@ static int ttusb_dec_boot_dsp(struct ttusb_dec *dec)
result = ttusb_dec_send_command(dec, 0x41, sizeof(b0), b0, NULL, NULL); result = ttusb_dec_send_command(dec, 0x41, sizeof(b0), b0, NULL, NULL);
if (result) if (result) {
release_firmware(fw_entry);
return result; return result;
}
trans_count = 0; trans_count = 0;
j = 0; j = 0;
b = kmalloc(ARM_PACKET_SIZE, GFP_KERNEL); b = kmalloc(ARM_PACKET_SIZE, GFP_KERNEL);
if (b == NULL) if (b == NULL) {
release_firmware(fw_entry);
return -ENOMEM; return -ENOMEM;
}
for (i = 0; i < firmware_size; i += COMMAND_PACKET_SIZE) { for (i = 0; i < firmware_size; i += COMMAND_PACKET_SIZE) {
size = firmware_size - i; size = firmware_size - i;
...@@ -1345,6 +1351,7 @@ static int ttusb_dec_boot_dsp(struct ttusb_dec *dec) ...@@ -1345,6 +1351,7 @@ static int ttusb_dec_boot_dsp(struct ttusb_dec *dec)
result = ttusb_dec_send_command(dec, 0x43, sizeof(b1), b1, NULL, NULL); result = ttusb_dec_send_command(dec, 0x43, sizeof(b1), b1, NULL, NULL);
release_firmware(fw_entry);
kfree(b); kfree(b);
return result; return result;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment