Skip to content

Commit ba874a8

Browse files
krzkvinodkoul
authored andcommitted
soundwire: intel: simplify return path in hw_params
Remove unused error path (label+goto) to make the code a bit simpler. Signed-off-by: Krzysztof Kozlowski <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Vinod Koul <[email protected]>
1 parent 1f93cb2 commit ba874a8

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

drivers/soundwire/intel.c

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -743,10 +743,8 @@ static int intel_hw_params(struct snd_pcm_substream *substream,
743743

744744
pdi = sdw_cdns_alloc_pdi(cdns, &cdns->pcm, ch, dir, dai->id);
745745

746-
if (!pdi) {
747-
ret = -EINVAL;
748-
goto error;
749-
}
746+
if (!pdi)
747+
return -EINVAL;
750748

751749
/* do run-time configurations for SHIM, ALH and PDI/PORT */
752750
intel_pdi_shim_configure(sdw, pdi);
@@ -763,7 +761,7 @@ static int intel_hw_params(struct snd_pcm_substream *substream,
763761
sdw->instance,
764762
pdi->intel_alh_id);
765763
if (ret)
766-
goto error;
764+
return ret;
767765

768766
sconfig.direction = dir;
769767
sconfig.ch_count = ch;
@@ -774,10 +772,8 @@ static int intel_hw_params(struct snd_pcm_substream *substream,
774772

775773
/* Port configuration */
776774
pconfig = kzalloc(sizeof(*pconfig), GFP_KERNEL);
777-
if (!pconfig) {
778-
ret = -ENOMEM;
779-
goto error;
780-
}
775+
if (!pconfig)
776+
return -ENOMEM;
781777

782778
pconfig->num = pdi->num;
783779
pconfig->ch_mask = (1 << ch) - 1;
@@ -788,7 +784,7 @@ static int intel_hw_params(struct snd_pcm_substream *substream,
788784
dev_err(cdns->dev, "add master to stream failed:%d\n", ret);
789785

790786
kfree(pconfig);
791-
error:
787+
792788
return ret;
793789
}
794790

0 commit comments

Comments
 (0)