Commit b027d112 authored by Andrej Krutak's avatar Andrej Krutak Committed by Takashi Iwai

ALSA: line6: Fix POD sysfs attributes segfault

The commit 02fc76f6 changed base of the sysfs attributes from device to card.
The "show" callbacks dereferenced wrong objects because of this.

Fixes: 02fc76f6 ('ALSA: line6: Create sysfs via snd_card_add_dev_attr()')
Cc: <stable@vger.kernel.org> # v4.0+
Reviewed-by: default avatarStefan Hajnoczi <stefanha@gmail.com>
Signed-off-by: default avatarAndrej Krutak <dev@andree.sk>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent adc8a43a
...@@ -244,8 +244,8 @@ static int pod_set_system_param_int(struct usb_line6_pod *pod, int value, ...@@ -244,8 +244,8 @@ static int pod_set_system_param_int(struct usb_line6_pod *pod, int value,
static ssize_t serial_number_show(struct device *dev, static ssize_t serial_number_show(struct device *dev,
struct device_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
struct usb_interface *interface = to_usb_interface(dev); struct snd_card *card = dev_to_snd_card(dev);
struct usb_line6_pod *pod = usb_get_intfdata(interface); struct usb_line6_pod *pod = card->private_data;
return sprintf(buf, "%u\n", pod->serial_number); return sprintf(buf, "%u\n", pod->serial_number);
} }
...@@ -256,8 +256,8 @@ static ssize_t serial_number_show(struct device *dev, ...@@ -256,8 +256,8 @@ static ssize_t serial_number_show(struct device *dev,
static ssize_t firmware_version_show(struct device *dev, static ssize_t firmware_version_show(struct device *dev,
struct device_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
struct usb_interface *interface = to_usb_interface(dev); struct snd_card *card = dev_to_snd_card(dev);
struct usb_line6_pod *pod = usb_get_intfdata(interface); struct usb_line6_pod *pod = card->private_data;
return sprintf(buf, "%d.%02d\n", pod->firmware_version / 100, return sprintf(buf, "%d.%02d\n", pod->firmware_version / 100,
pod->firmware_version % 100); pod->firmware_version % 100);
...@@ -269,8 +269,8 @@ static ssize_t firmware_version_show(struct device *dev, ...@@ -269,8 +269,8 @@ static ssize_t firmware_version_show(struct device *dev,
static ssize_t device_id_show(struct device *dev, static ssize_t device_id_show(struct device *dev,
struct device_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
struct usb_interface *interface = to_usb_interface(dev); struct snd_card *card = dev_to_snd_card(dev);
struct usb_line6_pod *pod = usb_get_intfdata(interface); struct usb_line6_pod *pod = card->private_data;
return sprintf(buf, "%d\n", pod->device_id); return sprintf(buf, "%d\n", pod->device_id);
} }
......
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