@@ -441,21 +441,21 @@ static int hdac_hda_codec_probe(struct snd_soc_component *component)
441
441
ret = snd_hda_codec_set_name (hcodec , hcodec -> preset -> name );
442
442
if (ret < 0 ) {
443
443
dev_err (& hdev -> dev , "name failed %s\n" , hcodec -> preset -> name );
444
- goto error ;
444
+ goto error_pm ;
445
445
}
446
446
447
447
ret = snd_hdac_regmap_init (& hcodec -> core );
448
448
if (ret < 0 ) {
449
449
dev_err (& hdev -> dev , "regmap init failed\n" );
450
- goto error ;
450
+ goto error_pm ;
451
451
}
452
452
453
453
patch = (hda_codec_patch_t )hcodec -> preset -> driver_data ;
454
454
if (patch ) {
455
455
ret = patch (hcodec );
456
456
if (ret < 0 ) {
457
457
dev_err (& hdev -> dev , "patch failed %d\n" , ret );
458
- goto error ;
458
+ goto error_regmap ;
459
459
}
460
460
} else {
461
461
dev_dbg (& hdev -> dev , "no patch file found\n" );
@@ -467,7 +467,7 @@ static int hdac_hda_codec_probe(struct snd_soc_component *component)
467
467
ret = snd_hda_codec_parse_pcms (hcodec );
468
468
if (ret < 0 ) {
469
469
dev_err (& hdev -> dev , "unable to map pcms to dai %d\n" , ret );
470
- goto error ;
470
+ goto error_regmap ;
471
471
}
472
472
473
473
/* HDMI controls need to be created in machine drivers */
@@ -476,7 +476,7 @@ static int hdac_hda_codec_probe(struct snd_soc_component *component)
476
476
if (ret < 0 ) {
477
477
dev_err (& hdev -> dev , "unable to create controls %d\n" ,
478
478
ret );
479
- goto error ;
479
+ goto error_regmap ;
480
480
}
481
481
}
482
482
@@ -496,7 +496,9 @@ static int hdac_hda_codec_probe(struct snd_soc_component *component)
496
496
497
497
return 0 ;
498
498
499
- error :
499
+ error_regmap :
500
+ snd_hdac_regmap_exit (hdev );
501
+ error_pm :
500
502
pm_runtime_put (& hdev -> dev );
501
503
error_no_pm :
502
504
snd_hdac_ext_bus_link_put (hdev -> bus , hlink );
@@ -518,6 +520,8 @@ static void hdac_hda_codec_remove(struct snd_soc_component *component)
518
520
519
521
pm_runtime_disable (& hdev -> dev );
520
522
snd_hdac_ext_bus_link_put (hdev -> bus , hlink );
523
+
524
+ snd_hdac_regmap_exit (hdev );
521
525
}
522
526
523
527
static const struct snd_soc_dapm_route hdac_hda_dapm_routes [] = {
0 commit comments