diff --git a/sound/core/info.c b/sound/core/info.c index 1f5b8a3d9e3b..e584f3eb742b 100644 --- a/sound/core/info.c +++ b/sound/core/info.c @@ -566,7 +566,9 @@ int snd_info_card_free(struct snd_card *card) { if (!card) return 0; + printk("card: %p, %s\n", card, __func__); snd_info_free_entry(card->proc_root); + printk("2card: %p, %s\n", card, __func__); card->proc_root = NULL; return 0; } diff --git a/sound/core/init.c b/sound/core/init.c index 114fb87de990..84b88b1192d0 100644 --- a/sound/core/init.c +++ b/sound/core/init.c @@ -186,6 +186,7 @@ int snd_card_new(struct device *parent, int idx, const char *xid, return -ENOMEM; err = snd_card_init(card, parent, idx, xid, module, extra_size); + printk("err: %d, card: %p, %s\n", err, card, __func__); if (err < 0) return err; /* card is freed by error handler */ @@ -580,11 +581,14 @@ EXPORT_SYMBOL_GPL(snd_card_disconnect_sync); static int snd_card_do_free(struct snd_card *card) { card->releasing = true; + printk("0card: %p, %s\n", card, __func__); #if IS_ENABLED(CONFIG_SND_MIXER_OSS) if (snd_mixer_oss_notify_callback) snd_mixer_oss_notify_callback(card, SND_MIXER_OSS_NOTIFY_FREE); #endif + printk("1card: %p, %s\n", card, __func__); snd_device_free_all(card); + printk("2card: %p, %s\n", card, __func__); if (card->private_free) card->private_free(card); if (snd_info_card_free(card) < 0) { diff --git a/sound/usb/usx2y/usbusx2y.c b/sound/usb/usx2y/usbusx2y.c index 2f9cede242b3..129210a81545 100644 --- a/sound/usb/usx2y/usbusx2y.c +++ b/sound/usb/usx2y/usbusx2y.c @@ -150,6 +150,7 @@ static int snd_usx2y_card_used[SNDRV_CARDS]; static void snd_usx2y_card_private_free(struct snd_card *card); static void usx2y_unlinkseq(struct snd_usx2y_async_seq *s); +static DEFINE_MUTEX(devices_mutex); /* * pipe 4 is used for switching the lamps, setting samplerate, volumes .... @@ -392,6 +393,7 @@ static void snd_usx2y_card_private_free(struct snd_card *card) { struct usx2ydev *usx2y = usx2y(card); + printk("card: %p, %s\n", card, __func__); kfree(usx2y->in04_buf); usb_free_urb(usx2y->in04_urb); if (usx2y->us428ctls_sharedmem) @@ -407,9 +409,12 @@ static void snd_usx2y_disconnect(struct usb_interface *intf) struct usx2ydev *usx2y; struct list_head *p; + mutex_lock(&devices_mutex); card = usb_get_intfdata(intf); - if (!card) + if (!card) { + mutex_unlock(&devices_mutex); return; + } usx2y = usx2y(card); usx2y->chip_status = USX2Y_STAT_CHIP_HUP; usx2y_unlinkseq(&usx2y->as04); @@ -423,6 +428,7 @@ static void snd_usx2y_disconnect(struct usb_interface *intf) if (usx2y->us428ctls_sharedmem) wake_up(&usx2y->us428ctls_wait_queue_head); snd_card_free(card); + mutex_unlock(&devices_mutex); } static int snd_usx2y_probe(struct usb_interface *intf, @@ -432,15 +438,18 @@ static int snd_usx2y_probe(struct usb_interface *intf, struct snd_card *card; int err; + mutex_lock(&devices_mutex); if (le16_to_cpu(device->descriptor.idVendor) != 0x1604 || (le16_to_cpu(device->descriptor.idProduct) != USB_ID_US122 && le16_to_cpu(device->descriptor.idProduct) != USB_ID_US224 && - le16_to_cpu(device->descriptor.idProduct) != USB_ID_US428)) - return -EINVAL; + le16_to_cpu(device->descriptor.idProduct) != USB_ID_US428)) { + err = -EINVAL; + goto out; + } err = usx2y_create_card(device, intf, &card); if (err < 0) - return err; + goto out; err = usx2y_hwdep_new(card, device); if (err < 0) goto error; @@ -449,10 +458,13 @@ static int snd_usx2y_probe(struct usb_interface *intf, goto error; dev_set_drvdata(&intf->dev, card); + mutex_unlock(&devices_mutex); return 0; - error: +error: snd_card_free(card); +out: + mutex_unlock(&devices_mutex); return err; } diff --git a/net/batman-adv/hard-interface.c b/net/batman-adv/hard-interface.c index 96a412beab2d..9e5a0eb43fec 100644 --- a/net/batman-adv/hard-interface.c +++ b/net/batman-adv/hard-interface.c @@ -523,9 +523,9 @@ static void batadv_check_known_mac_addr(const struct net_device *net_dev) net_dev->dev_addr)) continue; - pr_warn("The newly added mac address (%pM) already exists on: %s\n", + pr_warn_ratelimited("The newly added mac address (%pM) already exists on: %s\n", net_dev->dev_addr, hard_iface->net_dev->name); - pr_warn("It is strongly recommended to keep mac addresses unique to avoid problems!\n"); + pr_warn_ratelimited("It is strongly recommended to keep mac addresses unique to avoid problems!\n"); } rcu_read_unlock(); }