staging: most: sound: call snd_card_new with struct device
authorChristian Gromm <christian.gromm@microchip.com>
Tue, 8 May 2018 09:45:04 +0000 (11:45 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 8 May 2018 11:41:50 +0000 (13:41 +0200)
This patch is needed as function snd_card_new needs a valid
parent device. Passing a NULL pointer leads to kernel Ooops.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/most/core.h
drivers/staging/most/sound/sound.c
drivers/staging/most/usb/usb.c

index 7a3c70bead19b61fa0f30484c565337feff9c332..64cc02f161e7292127b1e97b5a6cd9b77b5cc93c 100644 (file)
@@ -230,6 +230,7 @@ struct mbo {
  */
 struct most_interface {
        struct device dev;
+       struct device *driver_dev;
        struct module *mod;
        enum most_interface_type interface;
        const char *description;
index 18f722410a630644d4838e1206b138ed204aded4..04c18323c2eab9525bcab502642e82d2236027dc 100644 (file)
@@ -590,7 +590,7 @@ static int audio_probe_channel(struct most_interface *iface, int channel_id,
        if (ret < 0)
                return ret;
 
-       ret = snd_card_new(NULL, -1, card_name, THIS_MODULE,
+       ret = snd_card_new(&iface->dev, -1, card_name, THIS_MODULE,
                           sizeof(*channel), &card);
        if (ret < 0)
                return ret;
index 5ed1dccc0839b4d47bc80d336ad185b047af8430..f1872604952800a2a2f5117225aa68989a4b1d44 100644 (file)
@@ -1043,6 +1043,7 @@ hdm_probe(struct usb_interface *interface, const struct usb_device_id *id)
        mdev->link_stat_timer.expires = jiffies + (2 * HZ);
 
        mdev->iface.mod = hdm_usb_fops.owner;
+       mdev->iface.driver_dev = &interface->dev;
        mdev->iface.interface = ITYPE_USB;
        mdev->iface.configure = hdm_configure_channel;
        mdev->iface.request_netinfo = hdm_request_netinfo;