ASoC: Intel: consistent HDMI codec probing code
authorGuennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Fri, 24 Jan 2020 21:36:25 +0000 (15:36 -0600)
committerMark Brown <broonie@kernel.org>
Mon, 27 Jan 2020 17:52:11 +0000 (17:52 +0000)
commit98ff5c262f27aafee077a4c096f71a8566e9e948
treeb9d52e105391802c99d02764139b6173a83b3f55
parentbd01cf38eedceb87d43f9205a75b259361e056ea
ASoC: Intel: consistent HDMI codec probing code

Multiple Intel ASoC machine drivers repeat the same pattern in their
.late_probe() methods: they first check whether the common HDMI codec
driver is used, if not, they proceed by linking the legacy HDMI
driver to each HDMI port. While doing that they use some
inconsistent code:

1. after the loop they check, whether the list contained at least one
   element and if not, they return an error. However, the earlier
   code to use the common HDMI driver uses the first element of the
   same list without checking. To fix this we move the check to the
   top of the function.

2. some of those .late_probe() implementations execute code, only
   needed for the common HDMI driver, before checking, whether the
   driver is used. Move the code to after the check.

3. Some of those functions also perform a redundant initialisation of
   the "err" variable.

This patch fixes those issues.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20200124213625.30186-8-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/intel/boards/bxt_da7219_max98357a.c
sound/soc/intel/boards/bxt_rt298.c
sound/soc/intel/boards/cml_rt1011_rt5682.c
sound/soc/intel/boards/glk_rt5682_max98357a.c
sound/soc/intel/boards/sof_rt5682.c