summaryrefslogtreecommitdiff
path: root/sound/soc/fsl
diff options
context:
space:
mode:
authorYang Yingliang <yangyingliang@huawei.com>2021-06-15 04:39:22 +0300
committerMark Brown <broonie@kernel.org>2021-06-21 15:03:18 +0300
commita2f6ed4a44721d3a9fdf4da7e0743cb13866bf61 (patch)
tree4ae1a3c0d42d58d827de42adaccbf1ba4266c6e7 /sound/soc/fsl
parent67798860e6d0114149562e6897cf07ba4bebc1d6 (diff)
downloadlinux-a2f6ed4a44721d3a9fdf4da7e0743cb13866bf61.tar.xz
ASoC: fsl_xcvr: check return value after calling platform_get_resource_byname()
It will cause null-ptr-deref if platform_get_resource_byname() returns NULL, we need check the return value. Signed-off-by: Yang Yingliang <yangyingliang@huawei.com> Link: https://lore.kernel.org/r/20210615013922.784296-10-yangyingliang@huawei.com Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/fsl')
-rw-r--r--sound/soc/fsl/fsl_xcvr.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/sound/soc/fsl/fsl_xcvr.c b/sound/soc/fsl/fsl_xcvr.c
index df7c189d97dd..1330e190e1ff 100644
--- a/sound/soc/fsl/fsl_xcvr.c
+++ b/sound/soc/fsl/fsl_xcvr.c
@@ -1202,6 +1202,10 @@ static int fsl_xcvr_probe(struct platform_device *pdev)
rx_res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "rxfifo");
tx_res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "txfifo");
+ if (!rx_res || !tx_res) {
+ dev_err(dev, "could not find rxfifo or txfifo resource\n");
+ return -EINVAL;
+ }
xcvr->dma_prms_rx.chan_name = "rx";
xcvr->dma_prms_tx.chan_name = "tx";
xcvr->dma_prms_rx.addr = rx_res->start;