From: Andrej Krutak <dev@andree.sk>
To: tiwai@suse.com, perex@perex.cz, stefanha@gmail.com,
grabner@icg.tugraz.at, alsa-devel@alsa-project.org
Cc: Andrej Krutak <dev@andree.sk>
Subject: [PATCH 3/3] ALSA: line6: Fix POD sysfs attributes segfault
Date: Thu, 18 Aug 2016 23:52:12 +0200 [thread overview]
Message-ID: <1471557132-10206-4-git-send-email-dev@andree.sk> (raw)
In-Reply-To: <1471557132-10206-1-git-send-email-dev@andree.sk>
The commit 02fc76f6a changed base of the sysfs attributes from device to card.
The "show" callbacks dereferenced wrong objects because of this.
---
sound/usb/line6/pod.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/sound/usb/line6/pod.c b/sound/usb/line6/pod.c
index daf81d1..45dd348 100644
--- a/sound/usb/line6/pod.c
+++ b/sound/usb/line6/pod.c
@@ -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,
struct device_attribute *attr, char *buf)
{
- struct usb_interface *interface = to_usb_interface(dev);
- struct usb_line6_pod *pod = usb_get_intfdata(interface);
+ struct snd_card *card = dev_to_snd_card(dev);
+ struct usb_line6_pod *pod = card->private_data;
return sprintf(buf, "%u\n", pod->serial_number);
}
@@ -256,8 +256,8 @@ static ssize_t serial_number_show(struct device *dev,
static ssize_t firmware_version_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
- struct usb_interface *interface = to_usb_interface(dev);
- struct usb_line6_pod *pod = usb_get_intfdata(interface);
+ struct snd_card *card = dev_to_snd_card(dev);
+ struct usb_line6_pod *pod = card->private_data;
return sprintf(buf, "%d.%02d\n", pod->firmware_version / 100,
pod->firmware_version % 100);
@@ -269,8 +269,8 @@ static ssize_t firmware_version_show(struct device *dev,
static ssize_t device_id_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
- struct usb_interface *interface = to_usb_interface(dev);
- struct usb_line6_pod *pod = usb_get_intfdata(interface);
+ struct snd_card *card = dev_to_snd_card(dev);
+ struct usb_line6_pod *pod = card->private_data;
return sprintf(buf, "%d\n", pod->device_id);
}
--
1.9.1
next prev parent reply other threads:[~2016-08-18 21:52 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-18 21:52 [PATCH 0/3] line6 locking and segfault fixes Andrej Krutak
2016-08-18 21:52 ` [PATCH 1/3] ALSA: line6: Remove double line6_pcm_release() after failed acquire Andrej Krutak
2016-08-19 5:54 ` Stefan Hajnoczi
2016-08-18 21:52 ` [PATCH 2/3] ALSA: line6: Give up on the lock while URBs are released Andrej Krutak
2016-08-18 21:52 ` Andrej Krutak [this message]
2016-08-19 5:54 ` [PATCH 3/3] ALSA: line6: Fix POD sysfs attributes segfault Stefan Hajnoczi
2016-08-22 12:03 ` [PATCH 0/3] line6 locking and segfault fixes Takashi Iwai
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1471557132-10206-4-git-send-email-dev@andree.sk \
--to=dev@andree.sk \
--cc=alsa-devel@alsa-project.org \
--cc=grabner@icg.tugraz.at \
--cc=perex@perex.cz \
--cc=stefanha@gmail.com \
--cc=tiwai@suse.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).