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

Commit 6fee7bed authored by wjiang's avatar wjiang Committed by Linux Build Service Account
Browse files

audio: init return code to avoid effect's fault state

Effect command doesn't necessarily fill cmd return code into &cmdStatus,
so we should initialize cmdStatus to avoid uninitialized value propagates
to upper stack caller.

Change-Id: I5694616c9d3d66071241958f54a03b8d3b9d881e

CRs-fixed: 1016867
Conflicts:
	services/audioflinger/Effects.cpp

Change-Id: I5694616c9d3d66071241958f54a03b8d3b9d881e
parent ca5beef3
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -318,6 +318,7 @@ void AudioFlinger::EffectModule::reset_l()
status_t AudioFlinger::EffectModule::configure()
{
    status_t status;
    status_t cmdStatus = 0;
    sp<ThreadBase> thread;
    uint32_t size;
    audio_channel_mask_t channelMask;
@@ -383,7 +384,6 @@ status_t AudioFlinger::EffectModule::configure()
    ALOGV("configure() %p thread %p buffer %p framecount %zu",
            this, thread.get(), mConfig.inputCfg.buffer.raw, mConfig.inputCfg.buffer.frameCount);

    status_t cmdStatus;
    size = sizeof(int);
    status = (*mEffectInterface)->command(mEffectInterface,
                                                   EFFECT_CMD_SET_CONFIG,
@@ -434,7 +434,7 @@ status_t AudioFlinger::EffectModule::init()
    if (mEffectInterface == NULL) {
        return NO_INIT;
    }
    status_t cmdStatus;
    status_t cmdStatus = 0;
    uint32_t size = sizeof(status_t);
    status_t status = (*mEffectInterface)->command(mEffectInterface,
                                                   EFFECT_CMD_INIT,
@@ -476,7 +476,7 @@ status_t AudioFlinger::EffectModule::start_l()
    if (mStatus != NO_ERROR) {
        return mStatus;
    }
    status_t cmdStatus;
    status_t cmdStatus = 0;
    uint32_t size = sizeof(status_t);
    status_t status = (*mEffectInterface)->command(mEffectInterface,
                                                   EFFECT_CMD_ENABLE,
@@ -717,7 +717,7 @@ status_t AudioFlinger::EffectModule::setDevice(audio_devices_t device)
    }
    status_t status = NO_ERROR;
    if ((mDescriptor.flags & EFFECT_FLAG_DEVICE_MASK) == EFFECT_FLAG_DEVICE_IND) {
        status_t cmdStatus;
        status_t cmdStatus = 0;
        uint32_t size = sizeof(status_t);
        uint32_t cmd = audio_is_output_devices(device) ? EFFECT_CMD_SET_DEVICE :
                            EFFECT_CMD_SET_INPUT_DEVICE;
@@ -739,7 +739,7 @@ status_t AudioFlinger::EffectModule::setMode(audio_mode_t mode)
    }
    status_t status = NO_ERROR;
    if ((mDescriptor.flags & EFFECT_FLAG_AUDIO_MODE_MASK) == EFFECT_FLAG_AUDIO_MODE_IND) {
        status_t cmdStatus;
        status_t cmdStatus = 0;
        uint32_t size = sizeof(status_t);
        status = (*mEffectInterface)->command(mEffectInterface,
                                              EFFECT_CMD_SET_AUDIO_MODE,