/*
Resolve value to memory location.
*/
-static void pod_resolve(const char *buf, short block0, short block1, unsigned char *location)
+static int pod_resolve(const char *buf, short block0, short block1, unsigned char *location)
{
- int value = simple_strtoul(buf, NULL, 10);
- short block = (value < 0x40) ? block0 : block1;
+ unsigned long value;
+ short block;
+ int ret;
+
+ ret = strict_strtoul(buf, 10, &value);
+ if (ret)
+ return ret;
+
+ block = (value < 0x40) ? block0 : block1;
value &= 0x3f;
location[0] = block >> 7;
location[1] = value | (block & 0x7f);
+ return 0;
}
/*
{
struct usb_interface *interface = to_usb_interface(dev);
struct usb_line6_pod *pod = usb_get_intfdata(interface);
-
+ int ret;
int size = 3 + sizeof(pod->prog_data_buf);
char *sysex = pod_alloc_sysex_buffer(pod, POD_SYSEX_STORE, size);
+
if (!sysex)
return 0;
sysex[SYSEX_DATA_OFS] = 5; /* see pod_dump() */
- pod_resolve(buf, block0, block1, sysex + SYSEX_DATA_OFS + 1);
+ ret = pod_resolve(buf, block0, block1, sysex + SYSEX_DATA_OFS + 1);
+ if (ret) {
+ kfree(sysex);
+ return ret;
+ }
+
memcpy(sysex + SYSEX_DATA_OFS + 3, &pod->prog_data_buf, sizeof(pod->prog_data_buf));
line6_send_sysex_message(&pod->line6, sysex, size);
{
struct usb_interface *interface = to_usb_interface(dev);
struct usb_line6_pod *pod = usb_get_intfdata(interface);
+ int ret;
int size = 4;
char *sysex = pod_alloc_sysex_buffer(pod, POD_SYSEX_DUMPMEM, size);
if (!sysex)
return 0;
- pod_resolve(buf, block0, block1, sysex + SYSEX_DATA_OFS);
+ ret = pod_resolve(buf, block0, block1, sysex + SYSEX_DATA_OFS);
+ if (ret) {
+ kfree(sysex);
+ return ret;
+ }
sysex[SYSEX_DATA_OFS + 2] = 0;
sysex[SYSEX_DATA_OFS + 3] = 0;
line6_dump_started(&pod->dumpreq, POD_DUMP_MEMORY);
{
struct usb_interface *interface = to_usb_interface(dev);
struct usb_line6_pod *pod = usb_get_intfdata(interface);
- int value = simple_strtoul(buf, NULL, 10);
+ unsigned long value;
+ int ret;
+
+ ret = strict_strtoul(buf, 10, &value);
+ if (ret)
+ return ret;
+
pod_send_channel(pod, value);
return count;
}
char *sysex;
static const int size = 5;
unsigned short value;
+ unsigned long result;
+ int ret;
if (((pod->prog_data.control[POD_tuner] & 0x40) == 0) && tuner)
return -EINVAL;
sysex = pod_alloc_sysex_buffer(pod, POD_SYSEX_SYSTEM, size);
if (!sysex)
return 0;
- value = simple_strtoul(buf, NULL, 10) & mask;
+
+ ret = strict_strtoul(buf, 10, &result);
+ if (ret)
+ return ret;
+
+ value = result & mask;
sysex[SYSEX_DATA_OFS] = code;
sysex[SYSEX_DATA_OFS + 1] = (value >> 12) & 0x0f;
sysex[SYSEX_DATA_OFS + 2] = (value >> 8) & 0x0f;
{
struct usb_interface *interface = to_usb_interface(dev);
struct usb_line6_pod *pod = usb_get_intfdata(interface);
- int value = simple_strtoul(buf, NULL, 10);
+ unsigned long value;
+ int ret;
+
+ ret = strict_strtoul(buf, 10, &value);
+ if (ret)
+ return ret;
+
pod->midi_postprocess = value ? 1 : 0;
return count;
}