OSDN Git Service

rtac: add NULL pointer check for asm handle
authorTimothy Sham <tsham@codeaurora.org>
Thu, 1 Aug 2019 15:17:07 +0000 (11:17 -0400)
committerGerrit - the friendly Code Review server <code-review@localhost>
Thu, 15 Aug 2019 22:09:47 +0000 (15:09 -0700)
Add NULL pointer check for asm handle before assignment.

Change-Id: Ic371c8486d153a6a95cd4e23d65ea0be0a9e70e8
Signed-off-by: Timothy Sham <tsham@codeaurora.org>
sound/soc/msm/qdsp6v2/rtac.c

index 0a33171..5572a3d 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2012-2019, The Linux Foundation. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 and
@@ -962,7 +962,8 @@ void rtac_set_asm_handle(u32 session_id, void *handle)
        pr_debug("%s\n", __func__);
 
        mutex_lock(&rtac_asm_apr_mutex);
-       rtac_asm_apr_data[session_id].apr_handle = handle;
+       if (rtac_asm_apr_data[session_id].apr_handle)
+               rtac_asm_apr_data[session_id].apr_handle = handle;
        mutex_unlock(&rtac_asm_apr_mutex);
 }