Unless ctx in cht_max98090_headset_init is null, &ctx->jack cannot be null, and the jack variable in ts3a227e_enable_jack_detect cannot be null. Tho options here:
- either the snd_soc_card driver data is null (card not initialized?)
- or ts3a227e_enable_jack_detect crashes because ts3a227e is null, which is the snd_soc_component driver data (component not initialized?)
- or ts3a227e_enable_jack_detect crashes because there is another pointer that is null. It doesn't look so...
The snd_soc_card driver data is initialized here:
static int snd_cht_mc_probe(struct platform_device *pdev)
{
int ret_val = 0;
struct cht_mc_private *drv;
drv = devm_kzalloc(&pdev->dev, sizeof(*drv), GFP_ATOMIC);
if (!drv)
return -ENOMEM;
drv->ts3a227e_present = acpi_dev_found("104C227E");
if (!drv->ts3a227e_present) {
/* no need probe TI jack detection chip */
snd_soc_card_cht.aux_dev = NULL;
snd_soc_card_cht.num_aux_devs = 0;
}
There is a null pointer in ts3a227e_ enable_ jack_detect. The function looks like this in sound/soc/ codecs/ ts3a227e. c:
int ts3a227e_ enable_ jack_detect( struct snd_soc_component *component, component_ get_drvdata( component) ;
struct snd_soc_jack *jack)
{
struct ts3a227e *ts3a227e = snd_soc_
snd_jack_ set_key( jack->jack, SND_JACK_BTN_0, KEY_MEDIA); set_key( jack->jack, SND_JACK_BTN_1, KEY_VOICECOMMAND); set_key( jack->jack, SND_JACK_BTN_2, KEY_VOLUMEUP); set_key( jack->jack, SND_JACK_BTN_3, KEY_VOLUMEDOWN);
snd_jack_
snd_jack_
snd_jack_
ts3a227e->jack = jack; jack_report( ts3a227e) ;
ts3a227e_
return 0;
}
Given the calling context in from sound/soc/ intel/boards/ cht_bsw_ max98090_ ti.c:
static int cht_max98090_ headset_ init(struct snd_soc_component *component) card_get_ drvdata( card);
{
struct snd_soc_card *card = component->card;
struct cht_mc_private *ctx = snd_soc_
return ts3a227e_ enable_ jack_detect( component, &ctx->jack);
}
And the driverdata struct:
struct cht_mc_private {
struct snd_soc_jack jack;
bool ts3a227e_present;
};
Unless ctx in cht_max98090_ headset_ init is null, &ctx->jack cannot be null, and the jack variable in ts3a227e_ enable_ jack_detect cannot be null. Tho options here:
- either the snd_soc_card driver data is null (card not initialized?) enable_ jack_detect crashes because ts3a227e is null, which is the snd_soc_component driver data (component not initialized?) enable_ jack_detect crashes because there is another pointer that is null. It doesn't look so...
- or ts3a227e_
- or ts3a227e_
The snd_soc_card driver data is initialized here:
static int snd_cht_ mc_probe( struct platform_device *pdev)
{
int ret_val = 0;
struct cht_mc_private *drv;
drv = devm_kzalloc( &pdev-> dev, sizeof(*drv), GFP_ATOMIC);
if (!drv)
return -ENOMEM;
drv->ts3a227e_ present = acpi_dev_ found(" 104C227E" ); ts3a227e_ present) { card_cht. aux_dev = NULL; card_cht. num_aux_ devs = 0;
if (!drv->
/* no need probe TI jack detection chip */
snd_soc_
snd_soc_
}
/* register the soc card */ card_cht. dev = &pdev->dev; card_set_ drvdata( &snd_soc_ card_cht, drv); soc_register_ card(&pdev- >dev, &snd_soc_card_cht); &pdev-> dev, soc_register_ card failed %d\n", ret_val); set_drvdata( pdev, &snd_soc_card_cht);
snd_soc_
snd_soc_
ret_val = devm_snd_
if (ret_val) {
dev_err(
"snd_
return ret_val;
}
platform_
return ret_val;
}
Which is referenced in the platform driver:
static struct platform_driver snd_cht_mc_driver = {
.driver = {
.name = "cht-bsw-max98090",
},
.probe = snd_cht_mc_probe,
};
module_ platform_ driver( snd_cht_ mc_driver)
I didn't see where snd_soc_ component_ set_drvdata was called...