Commit 976e3483 authored by Patrick Boettcher's avatar Patrick Boettcher Committed by Mauro Carvalho Chehab

V4L/DVB (4030): Minor code cleanup on the genpix-module

Minor code cleanup on the genpix-module.
Signed-off-by: default avatarPatrick Boettcher <pb@linuxtv.org>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@infradead.org>
parent 9bbe076f
...@@ -92,36 +92,38 @@ static int gp8psk_load_bcm4500fw(struct dvb_usb_device *d) ...@@ -92,36 +92,38 @@ static int gp8psk_load_bcm4500fw(struct dvb_usb_device *d)
return ret; return ret;
} }
if (gp8psk_usb_out_op(d, LOAD_BCM4500,1,0,NULL, 0)) { ret = -EINVAL;
release_firmware(fw);
return -EINVAL; if (gp8psk_usb_out_op(d, LOAD_BCM4500,1,0,NULL, 0))
} goto out_rel_fw;
info("downloaidng bcm4500 firmware from file '%s'",bcm4500_firmware); info("downloaidng bcm4500 firmware from file '%s'",bcm4500_firmware);
ptr = fw->data; ptr = fw->data;
buf = (u8 *) kmalloc(512, GFP_KERNEL | GFP_DMA); buf = kmalloc(512, GFP_KERNEL | GFP_DMA);
while (ptr[0] != 0xff) { while (ptr[0] != 0xff) {
u16 buflen = ptr[0] + 4; u16 buflen = ptr[0] + 4;
if (ptr + buflen >= fw->data + fw->size) { if (ptr + buflen >= fw->data + fw->size) {
err("failed to load bcm4500 firmware."); err("failed to load bcm4500 firmware.");
release_firmware(fw); goto out_free;
kfree(buf);
return -EINVAL;
} }
memcpy(buf, ptr, buflen); memcpy(buf, ptr, buflen);
if (dvb_usb_generic_write(d, buf, buflen)) { if (dvb_usb_generic_write(d, buf, buflen)) {
err("failed to load bcm4500 firmware."); err("failed to load bcm4500 firmware.");
release_firmware(fw); goto out_free;
kfree(buf);
return -EIO;
} }
ptr += buflen; ptr += buflen;
} }
release_firmware(fw);
ret = 0;
out_free:
kfree(buf); kfree(buf);
return 0; out_rel_fw:
release_firmware(fw);
return ret;
} }
static int gp8psk_power_ctrl(struct dvb_usb_device *d, int onoff) static int gp8psk_power_ctrl(struct dvb_usb_device *d, int onoff)
......
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