Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ALSA: mtpav: Don't call card private_free at probe error path

The card destructor of nm256 driver does merely stopping the running
timer, and it's superfluous for the probe error handling. Moreover,
calling this via the previous devres change would lead to another
problem due to the reverse call order.

This patch moves the setup of the private_free callback after the card
registration, so that it can be used only after fully set up.

Fixes: aa92050f10f0 ("ALSA: mtpav: Allocate resources with device-managed APIs")
Link: https://lore.kernel.org/r/20220412102636.16000-39-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>

+2 -2
+2 -2
sound/drivers/mtpav.c
··· 693 693 mtp_card->outmidihwport = 0xffffffff; 694 694 timer_setup(&mtp_card->timer, snd_mtpav_output_timer, 0); 695 695 696 - card->private_free = snd_mtpav_free; 697 - 698 696 err = snd_mtpav_get_RAWMIDI(mtp_card); 699 697 if (err < 0) 700 698 return err; ··· 713 715 err = snd_card_register(mtp_card->card); 714 716 if (err < 0) 715 717 return err; 718 + 719 + card->private_free = snd_mtpav_free; 716 720 717 721 platform_set_drvdata(dev, card); 718 722 printk(KERN_INFO "Motu MidiTimePiece on parallel port irq: %d ioport: 0x%lx\n", irq, port);