Skip to content

Commit 13814ed

Browse files
krzkvinodkoul
authored andcommitted
soundwire: intel_ace2x: 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 e4fcf15 commit 13814ed

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

drivers/soundwire/intel_ace2x.c

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -325,11 +325,8 @@ static int intel_hw_params(struct snd_pcm_substream *substream,
325325
dir = SDW_DATA_DIR_TX;
326326

327327
pdi = sdw_cdns_alloc_pdi(cdns, &cdns->pcm, ch, dir, dai->id);
328-
329-
if (!pdi) {
330-
ret = -EINVAL;
331-
goto error;
332-
}
328+
if (!pdi)
329+
return -EINVAL;
333330

334331
/* use same definitions for alh_id as previous generations */
335332
pdi->intel_alh_id = (sdw->instance * 16) + pdi->num + 3;
@@ -350,7 +347,7 @@ static int intel_hw_params(struct snd_pcm_substream *substream,
350347
sdw->instance,
351348
pdi->intel_alh_id);
352349
if (ret)
353-
goto error;
350+
return ret;
354351

355352
sconfig.direction = dir;
356353
sconfig.ch_count = ch;
@@ -361,10 +358,8 @@ static int intel_hw_params(struct snd_pcm_substream *substream,
361358

362359
/* Port configuration */
363360
pconfig = kzalloc(sizeof(*pconfig), GFP_KERNEL);
364-
if (!pconfig) {
365-
ret = -ENOMEM;
366-
goto error;
367-
}
361+
if (!pconfig)
362+
return -ENOMEM;
368363

369364
pconfig->num = pdi->num;
370365
pconfig->ch_mask = (1 << ch) - 1;
@@ -375,7 +370,7 @@ static int intel_hw_params(struct snd_pcm_substream *substream,
375370
dev_err(cdns->dev, "add master to stream failed:%d\n", ret);
376371

377372
kfree(pconfig);
378-
error:
373+
379374
return ret;
380375
}
381376

0 commit comments

Comments
 (0)