lkml.org 
[lkml]   [2021]   [Aug]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH -next] ASoC: sh: rz-ssi: Fix return value check in rz_ssi_dma_request()
    Date
    In case of error, the function dma_request_chan() returns ERR_PTR()
    and never returns NULL. Set 'dma_ch' to NULL, if dma_request_chan()
    returns error, so the code using 'dma_ch' can work correctly.

    Fixes: 26ac471c5354 ("ASoC: sh: rz-ssi: Add SSI DMAC support")
    Reported-by: Hulk Robot <hulkci@huawei.com>
    Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
    ---
    sound/soc/sh/rz-ssi.c | 8 +++++++-
    1 file changed, 7 insertions(+), 1 deletion(-)

    diff --git a/sound/soc/sh/rz-ssi.c b/sound/soc/sh/rz-ssi.c
    index ea8d33ede5d2..5ec78fd94d94 100644
    --- a/sound/soc/sh/rz-ssi.c
    +++ b/sound/soc/sh/rz-ssi.c
    @@ -676,11 +676,17 @@ static void rz_ssi_release_dma_channels(struct rz_ssi_priv *ssi)
    static int rz_ssi_dma_request(struct rz_ssi_priv *ssi, struct device *dev)
    {
    ssi->playback.dma_ch = dma_request_chan(dev, "tx");
    + if (IS_ERR(ssi->playback.dma_ch))
    + ssi->playback.dma_ch = NULL;
    ssi->capture.dma_ch = dma_request_chan(dev, "rx");
    + if (IS_ERR(ssi->capture.dma_ch))
    + ssi->capture.dma_ch = NULL;
    if (!ssi->playback.dma_ch && !ssi->capture.dma_ch) {
    ssi->playback.dma_ch = dma_request_chan(dev, "rt");
    - if (!ssi->playback.dma_ch)
    + if (IS_ERR(ssi->playback.dma_ch)) {
    + ssi->playback.dma_ch = NULL;
    goto no_dma;
    + }

    ssi->dma_rt = true;
    }
    --
    2.25.1
    \
     
     \ /
      Last update: 2021-08-17 04:55    [W:3.878 / U:0.008 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site