From 1aab93ff6d9120c51723b8f905ab8436a8555a27 Mon Sep 17 00:00:00 2001 From: Kamal Negi <kamaln@codeaurora.org> Date: Tue, 22 Mar 2016 16:57:06 +0530 Subject: [PATCH] FM: Fix Static Analysis Issues Removed unused variable and cleanup code for FM seek functionality. Change-Id: I01d9a55f76e1c7d68abfad9d513ae6b3625c5c77 --- libfm_jni/LibfmJni.cpp | 28 +++++++--------------------- 1 file changed, 7 insertions(+), 21 deletions(-) diff --git a/libfm_jni/LibfmJni.cpp b/libfm_jni/LibfmJni.cpp index d1a0942..52ad029 100644 --- a/libfm_jni/LibfmJni.cpp +++ b/libfm_jni/LibfmJni.cpp @@ -114,32 +114,18 @@ jboolean SetFreq(JNIEnv *env, jobject thiz, jfloat freq) jfloat Seek(JNIEnv *env, jobject thiz, jfloat freq, jboolean isUp) { - int ret = 0; - int tmp_freq; - int ret_freq; - float val; + int ret = JNI_FALSE; + float val = freq; - tmp_freq = (int)(freq * FREQ_MULT); //Eg, 87.55 * 100 --> 87550 - if (pFMRadio) + if (pFMRadio) { ret = pFMRadio->Set_mute(true); - else - ret = JNI_FALSE; - if (ret) { - ALOGE("%s, error, [ret=%d]\n", __func__, ret); - } - ALOGD("%s, [mute] [ret=%d]\n", __func__, ret); - if (pFMRadio) + ALOGD("%s, [mute] [ret=%d]\n", __func__, ret); ret = pFMRadio->Seek((int)isUp); - else - ret = JNI_FALSE; - if (ret < 0) { - ret_freq = tmp_freq; //seek error, so use original freq + ALOGD("%s, [freq=%f] [ret=%d]\n", __func__, freq, ret); + if (ret > 0) + val = (float)ret/FREQ_MULT; //Eg, 8755 / 100 --> 87.55 } - ALOGD("%s, [freq=%d] [ret=%d]\n", __func__, ret_freq, ret); - - val = (float)ret/FREQ_MULT; //Eg, 8755 / 100 --> 87.55 - return val; } -- GitLab