OSDN Git Service

ASoC: topology: Perform component check upfront
authorAmadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Thu, 12 Mar 2020 12:22:39 +0000 (08:22 -0400)
committerMark Brown <broonie@kernel.org>
Thu, 12 Mar 2020 16:52:17 +0000 (16:52 +0000)
commitc42464a4e67383d8daeeaa668ff875e399a38105
treeae844075878479f5b1f19bce92ab4169ebc17442
parent6187509ba5ccbe83a1cc368a4096b7f96e578c22
ASoC: topology: Perform component check upfront

Function soc_tplg_dbytes_create(), calls soc_tplg_init_kcontrol() to
perform additional driver specific initialization. While
soc_tplg_init_kcontrol() ensures that component is valid before invoking
ops->control_load, there is no such check at the end of
soc_tplg_dbytes_create() where list_add() is used.

Also in quite a few places, there is reference of tplg->comp->dapm or
tplg->comp->card, without any checks for tplg->comp.

In consequence of the above this may lead to referencing NULL pointer.

This allows for removal of now unnecessary checks.

Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20200312122239.14489-1-amadeuszx.slawinski@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/soc-topology.c