[alsa-devel] [PATCH 07/39 v2] ASoC: simple-card-utils: add asoc_simple_card_parse_card_name()

Mark Brown broonie at kernel.org
Mon Jul 4 10:50:03 CEST 2016


On Mon, Jul 04, 2016 at 12:20:29AM +0000, Kuninori Morimoto wrote:

> > > > > > +	if (!card->name)
> > > > > > +		card->name = card->dai_link->name;

> > > > > This will unconditionally defererence dai_link but it's optional - we
> > > > > can have analogue only cards.

> > > > This is not new feature. Current simple-card already has it.

> > > Right, but simple-card does need DAIs IIRC while this is intended to be
> > > more general.  All it needs is a check before the dereference to be safe
> > > so it's trivial to handle.

> > Sorry, I'm not 100% understand.
> > Do you mean we don't need handle card->name ? (= we should remove above ?)
> > If so, we can't register card on simple-card. Because snd_soc_register_card()
> > requests it.

> This function tries to get card name from snd_soc_of_parse_card_name().
> and it tries to set card->name from dai_link if card still doesn't have name.
> So, above is optional 2nd try.
> Or, do you mean this if (!card->name) can goes to simple-card, instead of utils ?
> I have no objection about it , but it can be double handling ?
> Because other simple family have same situation.

If we try to dereference card->dai_link without checking to see if it's
set then we'll crash.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: not available
URL: <http://mailman.alsa-project.org/pipermail/alsa-devel/attachments/20160704/1d3a6cc5/attachment.sig>


More information about the Alsa-devel mailing list