Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4339e695 authored by Aravind Siddappaji's avatar Aravind Siddappaji
Browse files

primary-hal: Fix stability issues

Fixes to stability issues reported by static analysis tools.

Change-Id: Ief0057176170f6300a8521b1acfd706461f29244
parent e327f61c
Loading
Loading
Loading
Loading
+4 −4
Original line number Original line Diff line number Diff line
@@ -5,7 +5,7 @@
 * Copyright (C) 2013 The Android Open Source Project
 * Copyright (C) 2013 The Android Open Source Project
 *
 *
 * Changes from Qualcomm Innovation Center are provided under the following license:
 * Changes from Qualcomm Innovation Center are provided under the following license:
 * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
 * Copyright (c) 2022-2024 Qualcomm Innovation Center, Inc. All rights reserved.
 * SPDX-License-Identifier: BSD-3-Clause-Clear
 * SPDX-License-Identifier: BSD-3-Clause-Clear
 *
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * Licensed under the Apache License, Version 2.0 (the "License");
@@ -248,14 +248,14 @@ cleanup:
            free(key_info);
            free(key_info);
        }
        }


        if (my_data->acdb_init_data.snd_card_name)
            free(my_data->acdb_init_data.snd_card_name);

        if (result < 0) {
        if (result < 0) {


            if (snd_card_name)
            if (snd_card_name)
                free((void *)snd_card_name);
                free((void *)snd_card_name);


            if (my_data->acdb_init_data.snd_card_name)
                free(my_data->acdb_init_data.snd_card_name);

            if (my_data)
            if (my_data)
                platform_info_deinit();
                platform_info_deinit();
        }
        }
+5 −5
Original line number Original line Diff line number Diff line
@@ -30,7 +30,7 @@
/*
/*
* Changes from Qualcomm Innovation Center are provided under the following license:
* Changes from Qualcomm Innovation Center are provided under the following license:
*
*
* Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
* Copyright (c) 2022-2024 Qualcomm Innovation Center, Inc. All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without
* Redistribution and use in source and binary forms, with or without
* modification, are permitted (subject to the limitations in the
* modification, are permitted (subject to the limitations in the
@@ -1370,8 +1370,8 @@ static void* spkr_calibration_thread()
                        }
                        }
                       thermal_fd = open(wsa_path, O_RDONLY);
                       thermal_fd = open(wsa_path, O_RDONLY);
                       if (thermal_fd > 0) {
                       if (thermal_fd > 0) {
                           if ((ret = read(thermal_fd, buf, sizeof(buf))) >= 0) {
                           if ((ret = read(thermal_fd, buf, sizeof(buf)-1)) >= 0) {
                               buf[ret-1] = '\0';
                               buf[ret] = '\0';
                               t0_spk_1 = atoi(buf);
                               t0_spk_1 = atoi(buf);
                           }
                           }
                           else
                           else
@@ -1406,8 +1406,8 @@ static void* spkr_calibration_thread()
                        }
                        }
                        thermal_fd = open(wsa_path, O_RDONLY);
                        thermal_fd = open(wsa_path, O_RDONLY);
                        if (thermal_fd > 0) {
                        if (thermal_fd > 0) {
                           if ((ret = read(thermal_fd, buf, sizeof(buf))) >= 0) {
                           if ((ret = read(thermal_fd, buf, sizeof(buf)-1)) >= 0) {
                               buf[ret-1] = '\0';
                               buf[ret] = '\0';
                               t0_spk_2 = atoi(buf);
                               t0_spk_2 = atoi(buf);
                           }
                           }
                           else
                           else
+13 −3
Original line number Original line Diff line number Diff line
@@ -35,7 +35,7 @@
 * limitations under the License.
 * limitations under the License.
 *
 *
 * Changes from Qualcomm Innovation Center are provided under the following license:
 * Changes from Qualcomm Innovation Center are provided under the following license:
 * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
 * Copyright (c) 2023-2024 Qualcomm Innovation Center, Inc. All rights reserved.
 * SPDX-License-Identifier: BSD-3-Clause-Clear
 * SPDX-License-Identifier: BSD-3-Clause-Clear
 *
 *
 */
 */
@@ -10811,8 +10811,13 @@ int adev_create_audio_patch(struct audio_hw_device *dev,
        s_info = hashmapGet(adev->io_streams_map, (void *) (intptr_t) io_handle);
        s_info = hashmapGet(adev->io_streams_map, (void *) (intptr_t) io_handle);
        if (s_info == NULL) {
        if (s_info == NULL) {
            ALOGE("%s: Failed to obtain stream info", __func__);
            ALOGE("%s: Failed to obtain stream info", __func__);
            if (new_patch)
            if (new_patch) {

                if(p_info->patch)
                    free(p_info->patch);

                free(p_info);
                free(p_info);
            }
            pthread_mutex_unlock(&adev->lock);
            pthread_mutex_unlock(&adev->lock);
            ret = -EINVAL;
            ret = -EINVAL;
            goto done;
            goto done;
@@ -10833,8 +10838,13 @@ int adev_create_audio_patch(struct audio_hw_device *dev,
        if (ret < 0) {
        if (ret < 0) {
            pthread_mutex_lock(&adev->lock);
            pthread_mutex_lock(&adev->lock);
            s_info->patch_handle = AUDIO_PATCH_HANDLE_NONE;
            s_info->patch_handle = AUDIO_PATCH_HANDLE_NONE;
            if (new_patch)
            if (new_patch) {

                if(p_info->patch)
                    free(p_info->patch);

                free(p_info);
                free(p_info);
            }
            pthread_mutex_unlock(&adev->lock);
            pthread_mutex_unlock(&adev->lock);
            ALOGE("%s: Stream routing failed for io_handle %d", __func__, io_handle);
            ALOGE("%s: Stream routing failed for io_handle %d", __func__, io_handle);
            goto done;
            goto done;