aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/usb
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/usb')
-rw-r--r--drivers/media/usb/dvb-usb/dvb-usb-firmware.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/drivers/media/usb/dvb-usb/dvb-usb-firmware.c b/drivers/media/usb/dvb-usb/dvb-usb-firmware.c
index 53a11a064fc5..b8d2ac5833e9 100644
--- a/drivers/media/usb/dvb-usb/dvb-usb-firmware.c
+++ b/drivers/media/usb/dvb-usb/dvb-usb-firmware.c
@@ -36,16 +36,18 @@ static int usb_cypress_writemem(struct usb_device *udev,u16 addr,u8 *data, u8 le
36int usb_cypress_load_firmware(struct usb_device *udev, const struct firmware *fw, int type) 36int usb_cypress_load_firmware(struct usb_device *udev, const struct firmware *fw, int type)
37{ 37{
38 struct hexline *hx; 38 struct hexline *hx;
39 u8 reset; 39 u8 *buf;
40 int ret,pos=0; 40 int ret, pos = 0;
41 u16 cpu_cs_register = cypress[type].cpu_cs_register;
41 42
42 hx = kmalloc(sizeof(*hx), GFP_KERNEL); 43 buf = kmalloc(sizeof(*hx), GFP_KERNEL);
43 if (!hx) 44 if (!buf)
44 return -ENOMEM; 45 return -ENOMEM;
46 hx = (struct hexline *)buf;
45 47
46 /* stop the CPU */ 48 /* stop the CPU */
47 reset = 1; 49 buf[0] = 1;
48 if ((ret = usb_cypress_writemem(udev,cypress[type].cpu_cs_register,&reset,1)) != 1) 50 if (usb_cypress_writemem(udev, cpu_cs_register, buf, 1) != 1)
49 err("could not stop the USB controller CPU."); 51 err("could not stop the USB controller CPU.");
50 52
51 while ((ret = dvb_usb_get_hexline(fw, hx, &pos)) > 0) { 53 while ((ret = dvb_usb_get_hexline(fw, hx, &pos)) > 0) {
@@ -62,21 +64,21 @@ int usb_cypress_load_firmware(struct usb_device *udev, const struct firmware *fw
62 } 64 }
63 if (ret < 0) { 65 if (ret < 0) {
64 err("firmware download failed at %d with %d",pos,ret); 66 err("firmware download failed at %d with %d",pos,ret);
65 kfree(hx); 67 kfree(buf);
66 return ret; 68 return ret;
67 } 69 }
68 70
69 if (ret == 0) { 71 if (ret == 0) {
70 /* restart the CPU */ 72 /* restart the CPU */
71 reset = 0; 73 buf[0] = 0;
72 if (ret || usb_cypress_writemem(udev,cypress[type].cpu_cs_register,&reset,1) != 1) { 74 if (usb_cypress_writemem(udev, cpu_cs_register, buf, 1) != 1) {
73 err("could not restart the USB controller CPU."); 75 err("could not restart the USB controller CPU.");
74 ret = -EINVAL; 76 ret = -EINVAL;
75 } 77 }
76 } else 78 } else
77 ret = -EIO; 79 ret = -EIO;
78 80
79 kfree(hx); 81 kfree(buf);
80 82
81 return ret; 83 return ret;
82} 84}