[alsa-devel] [PATCH 4/4] ASoC: soc core allow machine driver to register the card

Mark Brown broonie at opensource.wolfsonmicro.com
Fri Jan 14 11:52:24 CET 2011

On Fri, Jan 14, 2011 at 09:54:59AM +0530, Koul, Vinod wrote:

> > > +	/* no card, so machine driver is registering card */
> > > +	if (!card)
> > > +		return 0;
> > > +

> > I'll review this one more closely tomorrow - as I said with the combined
> > patch I'd not expect the soc-audio device to be involved when the
> > machine driver is registering a card so I'd like to understand in more
> > detail why this is still required.

> If someone is still creating soc-audio device and not adding the drvdata the
> code following this will use a null pointer :(. So tried to protect, but again
> if people are doing right, then this shouldn't be invoked at all

If that's all it is then the check should be changed to return -EINVAL
or similar as this is an error which prevents the device being
instantiated.  It shouldn't pretend it succeeded, and not doing so will
save us having to check in any of the other functions.

More information about the Alsa-devel mailing list