ASoC: qdsp6: q6asm-dai: Fix a NULL vs IS_ERR() bug
authorDan Carpenter <dan.carpenter@oracle.com>
Fri, 21 Dec 2018 09:05:16 +0000 (12:05 +0300)
committerMark Brown <broonie@kernel.org>
Thu, 3 Jan 2019 16:32:55 +0000 (16:32 +0000)
The q6asm_audio_client_alloc() doesn't return NULL, it returns error
pointers.

Fixes: 22930c79ac5c ("ASoC: qdsp6: q6asm-dai: Add support to compress offload")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/qcom/qdsp6/q6asm-dai.c

index 9d738b4c1e05f106a400b771535e027bb259375f..3407e51b88613a8dd630ff760c6f9024737e3ea1 100644 (file)
@@ -570,10 +570,11 @@ static int q6asm_dai_compr_open(struct snd_compr_stream *stream)
        prtd->audio_client = q6asm_audio_client_alloc(dev,
                                        (q6asm_cb)compress_event_handler,
                                        prtd, stream_id, LEGACY_PCM_MODE);
-       if (!prtd->audio_client) {
+       if (IS_ERR(prtd->audio_client)) {
                dev_err(dev, "Could not allocate memory\n");
+               ret = PTR_ERR(prtd->audio_client);
                kfree(prtd);
-               return -ENOMEM;
+               return ret;
        }
 
        size = COMPR_PLAYBACK_MAX_FRAGMENT_SIZE *