summaryrefslogtreecommitdiff
path: root/linux
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@infradead.org>2008-07-17 23:26:40 -0300
committerMauro Carvalho Chehab <mchehab@infradead.org>2008-07-17 23:26:40 -0300
commita6b6470938e58aff69cdbf651e8476e3a26e7792 (patch)
tree659fb754dea1b7f918b82f9e1f14f4b9222d27d9 /linux
parente9dbf3fb1ea6040bd393fbb0c1314475c978b838 (diff)
downloadmediapointer-dvb-s2-a6b6470938e58aff69cdbf651e8476e3a26e7792.tar.gz
mediapointer-dvb-s2-a6b6470938e58aff69cdbf651e8476e3a26e7792.tar.bz2
backport commit e62f89f2aebd57f48687f139c20cf6375693b622
From: Mauro Carvalho Chehab <mchehab@infradead.org> Author: David Woodhouse <dwmw2@infradead.org> cxusb: treat firmware data as const ...which means allocating our own copy when we want to modify it. (stupid thinko fixed by mkrufky) kernel-sync: Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'linux')
-rw-r--r--linux/drivers/media/dvb/dvb-usb/cxusb.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/linux/drivers/media/dvb/dvb-usb/cxusb.c b/linux/drivers/media/dvb/dvb-usb/cxusb.c
index 9a3e97247..578afce68 100644
--- a/linux/drivers/media/dvb/dvb-usb/cxusb.c
+++ b/linux/drivers/media/dvb/dvb-usb/cxusb.c
@@ -24,6 +24,7 @@
* see Documentation/dvb/README.dvb-usb for more information
*/
#include <media/tuner.h>
+#include <linux/vmalloc.h>
#include "cxusb.h"
@@ -791,12 +792,26 @@ static int bluebird_patch_dvico_firmware_download(struct usb_device *udev,
if (fw->data[idoff] == (USB_VID_DVICO & 0xff) &&
fw->data[idoff + 1] == USB_VID_DVICO >> 8) {
- fw->data[idoff + 2] =
+ struct firmware new_fw;
+ u8 *new_fw_data = vmalloc(fw->size);
+ int ret;
+
+ if (!new_fw_data)
+ return -ENOMEM;
+
+ memcpy(new_fw_data, fw->data, fw->size);
+ new_fw.size = fw->size;
+ new_fw.data = new_fw_data;
+
+ new_fw_data[idoff + 2] =
le16_to_cpu(udev->descriptor.idProduct) + 1;
- fw->data[idoff + 3] =
+ new_fw_data[idoff + 3] =
le16_to_cpu(udev->descriptor.idProduct) >> 8;
- return usb_cypress_load_firmware(udev, fw, CYPRESS_FX2);
+ ret = usb_cypress_load_firmware(udev, &new_fw,
+ CYPRESS_FX2);
+ vfree(new_fw_data);
+ return ret;
}
}