diff options
author | David Woodhouse <dwmw2@infradead.org> | 2008-05-23 19:12:42 -0400 |
---|---|---|
committer | David Woodhouse <David.Woodhouse@intel.com> | 2008-07-10 09:26:33 -0400 |
commit | e62f89f2aebd57f48687f139c20cf6375693b622 (patch) | |
tree | 9c159b34b986aac8a3791a645cd5dbc989ca3cb2 /drivers | |
parent | bc179153ae2334efe28cf4f3300e024da7d83753 (diff) |
cxusb: treat firmware data as const
...which means allocating our own copy when we want to modify it.
(stupid thinko fixed by mkrufky)
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/media/dvb/dvb-usb/cxusb.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/drivers/media/dvb/dvb-usb/cxusb.c b/drivers/media/dvb/dvb-usb/cxusb.c index 720fcd1c3c1d..0286156704f2 100644 --- a/drivers/media/dvb/dvb-usb/cxusb.c +++ b/drivers/media/dvb/dvb-usb/cxusb.c | |||
@@ -24,6 +24,7 @@ | |||
24 | * see Documentation/dvb/README.dvb-usb for more information | 24 | * see Documentation/dvb/README.dvb-usb for more information |
25 | */ | 25 | */ |
26 | #include <media/tuner.h> | 26 | #include <media/tuner.h> |
27 | #include <linux/vmalloc.h> | ||
27 | 28 | ||
28 | #include "cxusb.h" | 29 | #include "cxusb.h" |
29 | 30 | ||
@@ -700,12 +701,26 @@ static int bluebird_patch_dvico_firmware_download(struct usb_device *udev, | |||
700 | 701 | ||
701 | if (fw->data[idoff] == (USB_VID_DVICO & 0xff) && | 702 | if (fw->data[idoff] == (USB_VID_DVICO & 0xff) && |
702 | fw->data[idoff + 1] == USB_VID_DVICO >> 8) { | 703 | fw->data[idoff + 1] == USB_VID_DVICO >> 8) { |
703 | fw->data[idoff + 2] = | 704 | struct firmware new_fw; |
705 | u8 *new_fw_data = vmalloc(fw->size); | ||
706 | int ret; | ||
707 | |||
708 | if (!new_fw_data) | ||
709 | return -ENOMEM; | ||
710 | |||
711 | memcpy(new_fw_data, fw->data, fw->size); | ||
712 | new_fw.size = fw->size; | ||
713 | new_fw.data = new_fw_data; | ||
714 | |||
715 | new_fw_data[idoff + 2] = | ||
704 | le16_to_cpu(udev->descriptor.idProduct) + 1; | 716 | le16_to_cpu(udev->descriptor.idProduct) + 1; |
705 | fw->data[idoff + 3] = | 717 | new_fw_data[idoff + 3] = |
706 | le16_to_cpu(udev->descriptor.idProduct) >> 8; | 718 | le16_to_cpu(udev->descriptor.idProduct) >> 8; |
707 | 719 | ||
708 | return usb_cypress_load_firmware(udev, fw, CYPRESS_FX2); | 720 | ret = usb_cypress_load_firmware(udev, &new_fw, |
721 | CYPRESS_FX2); | ||
722 | vfree(new_fw_data); | ||
723 | return ret; | ||
709 | } | 724 | } |
710 | } | 725 | } |
711 | 726 | ||