> On 29 Jun 2017, at 12:49, Takashi Iwai <tiwai@xxxxxxx> wrote: > > On Thu, 29 Jun 2017 12:46:33 +0200, > Delio Brignoli wrote: >> >> Hello Takashi, >> >> Commit “ALSA: Use standard device refcount for card accounting” <https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/sound/core/init.c?h=v4.12-rc6&id=f24640648186b59bd39f8cd640d631bdb61a3197> changed the behaviour of snd_card_free() in case of a NULL ptr argument. Before f24640648186b59bd39f8cd640d631bdb61a3197 snd_card_free() was a no-op in case of a NULL ptr argument as I would expect for a *_free() function. Currently passing a NULL ptr results in a NULL ptr dereference. >> >> I believe the previous behaviour is worth restoring. If you agree I’ll follow up with a patch. > > In which situation do you need to pass NULL to snd_card_free()? Unconditional calls to snd_card_free(), similarly to unconditional calls to free(). struct snd_card *card = NULL; … /* setup code */ if (something_goes_wrong) goto cleanup; … retval = snd_card_new(…, &card); … cleanup: snd_card_free(card); ... Sure, code can be re-organized to avoid it but *_free() function being a no-op in case of NULL ptr argument is the norm AFAIK. If so then why snd_card_free() should be different especially if it was doing the "right" thing before. Thank you -- Delio _______________________________________________ Alsa-devel mailing list Alsa-devel@xxxxxxxxxxxxxxxx http://mailman.alsa-project.org/mailman/listinfo/alsa-devel