From 89e641ae647a4ebc1d608fd56f331a4f4886da5f Mon Sep 17 00:00:00 2001 From: Kai Vehmanen Date: Wed, 27 Jan 2021 14:23:58 +0200 Subject: ASoC: SOF: add a pointer to download repo in case FW request fails The SOF firmware and topology files are not distributed via linux-firmware. To help debugging cases where correct firmware is not installed, print a pointer to the official upstream repository for Sound Open Firmware releases. BugLink: https://github.com/thesofproject/sof/issues/3665 Reported-by: Bruce Perens Signed-off-by: Kai Vehmanen Reviewed-by: Ranjani Sridharan Reviewed-by: Marc Herbert Reviewed-by: Liam Girdwood Link: https://lore.kernel.org/r/20210127122358.1014458-1-kai.vehmanen@linux.intel.com Signed-off-by: Mark Brown --- sound/soc/sof/topology.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'sound/soc/sof/topology.c') diff --git a/sound/soc/sof/topology.c b/sound/soc/sof/topology.c index b6b32a7a91f8..59f89f3d61a2 100644 --- a/sound/soc/sof/topology.c +++ b/sound/soc/sof/topology.c @@ -3740,6 +3740,8 @@ int snd_sof_load_topology(struct snd_soc_component *scomp, const char *file) if (ret < 0) { dev_err(scomp->dev, "error: tplg request firmware %s failed err: %d\n", file, ret); + dev_err(scomp->dev, + "you may need to download the firmware from https://github.com/thesofproject/sof-bin/\n"); return ret; } -- cgit v1.2.3 From 941d3f0d7e9ffcbee1efeb6f07fa5fc5ef8347ff Mon Sep 17 00:00:00 2001 From: Ranjani Sridharan Date: Mon, 1 Feb 2021 11:31:28 +0200 Subject: ASoC: SOF: topology: Prevent NULL pointer dereference with no TLV When there is no TLV data in topology, extracting the TLV data could result in a NULL pointer exception. Prevent this by making sure that the TLV data exists before extracting it. Signed-off-by: Ranjani Sridharan Reviewed-by: Guennadi Liakhovetski Reviewed-by: Paul Olaru Reviewed-by: Bard Liao Signed-off-by: Kai Vehmanen Link: https://lore.kernel.org/r/20210201093128.1226603-1-kai.vehmanen@linux.intel.com Signed-off-by: Mark Brown --- sound/soc/sof/topology.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound/soc/sof/topology.c') diff --git a/sound/soc/sof/topology.c b/sound/soc/sof/topology.c index 59f89f3d61a2..480cf75a7575 100644 --- a/sound/soc/sof/topology.c +++ b/sound/soc/sof/topology.c @@ -1073,7 +1073,7 @@ static int sof_control_load_volume(struct snd_soc_component *scomp, scontrol->cmd = SOF_CTRL_CMD_VOLUME; /* extract tlv data */ - if (get_tlv_data(kc->tlv.p, tlv) < 0) { + if (!kc->tlv.p || get_tlv_data(kc->tlv.p, tlv) < 0) { dev_err(scomp->dev, "error: invalid TLV data\n"); ret = -EINVAL; goto out_free; -- cgit v1.2.3