From: Joy Zou <[email protected]>

commit e708cbc250efab668507628d49bfec578b94f3ed from
https://github.com/nxp-imx/linux-imx.git lf-6.1.y

The bluetooth starts to use sdma before sdma driver initialization done.
It will cause NULL pointer access.

This patch adds sdma is_on check in order to avoid accessing NULL pointer.

Reviewed-by: Shengjiu Wang <[email protected]>
Signed-off-by: Joy Zou <[email protected]>
Signed-off-by: Xiaolei Wang <[email protected]>
---
 drivers/dma/imx-sdma.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c
index a5d5aa7b70ce..97269f6d5eec 100644
--- a/drivers/dma/imx-sdma.c
+++ b/drivers/dma/imx-sdma.c
@@ -2125,8 +2125,8 @@ static int sdma_config_write(struct dma_chan *chan,
        sdmac->watermark_level = 0;
        sdma_get_pc(sdmac, sdmac->peripheral_type);
 
-       if (!sdmac->sdma->fw_loaded && sdmac->is_ram_script) {
-               dev_warn_once(sdmac->sdma->dev, "sdma firmware not ready!\n");
+       if (!sdmac->sdma->is_on || (!sdmac->sdma->fw_loaded && 
sdmac->is_ram_script)) {
+               dev_warn_once(sdmac->sdma->dev, "sdma or sdma firmware not 
ready!\n");
                return -EPERM;
        }
 
-- 
2.25.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#12862): 
https://lists.yoctoproject.org/g/linux-yocto/message/12862
Mute This Topic: https://lists.yoctoproject.org/mt/100189686/21656
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/linux-yocto/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to