aboutsummaryrefslogtreecommitdiffstats
path: root/sound/core/device.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/core/device.c')
-rw-r--r--sound/core/device.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/sound/core/device.c b/sound/core/device.c
index 6ce4da4a1081..ccb25816ac9e 100644
--- a/sound/core/device.c
+++ b/sound/core/device.c
@@ -71,7 +71,7 @@ EXPORT_SYMBOL(snd_device_new);
71 * @device_data: the data pointer to release 71 * @device_data: the data pointer to release
72 * 72 *
73 * Removes the device from the list on the card and invokes the 73 * Removes the device from the list on the card and invokes the
74 * callback, dev_unregister or dev_free, corresponding to the state. 74 * callbacks, dev_disconnect and dev_free, corresponding to the state.
75 * Then release the device. 75 * Then release the device.
76 * 76 *
77 * Returns zero if successful, or a negative error code on failure or if the 77 * Returns zero if successful, or a negative error code on failure or if the
@@ -90,16 +90,14 @@ int snd_device_free(struct snd_card *card, void *device_data)
90 continue; 90 continue;
91 /* unlink */ 91 /* unlink */
92 list_del(&dev->list); 92 list_del(&dev->list);
93 if ((dev->state == SNDRV_DEV_REGISTERED || 93 if (dev->state == SNDRV_DEV_REGISTERED &&
94 dev->state == SNDRV_DEV_DISCONNECTED) && 94 dev->ops->dev_disconnect)
95 dev->ops->dev_unregister) { 95 if (dev->ops->dev_disconnect(dev))
96 if (dev->ops->dev_unregister(dev)) 96 snd_printk(KERN_ERR
97 snd_printk(KERN_ERR "device unregister failure\n"); 97 "device disconnect failure\n");
98 } else { 98 if (dev->ops->dev_free) {
99 if (dev->ops->dev_free) { 99 if (dev->ops->dev_free(dev))
100 if (dev->ops->dev_free(dev)) 100 snd_printk(KERN_ERR "device free failure\n");
101 snd_printk(KERN_ERR "device free failure\n");
102 }
103 } 101 }
104 kfree(dev); 102 kfree(dev);
105 return 0; 103 return 0;