ASoC: msm: Fix compile issue for "Check cleanly with sparse"

* Remove comparison of unsigned expression;
* Add static keyword for local variable;

Change-Id: I57d6cf8d94baf6108041f8476cb1cf38741bb3a7
Signed-off-by: Hongtao Peng <hongtaop@codeaurora.org>
This commit is contained in:
Hongtao Peng 2020-09-16 12:16:38 +08:00
parent c285d08046
commit fa5ffd2abe

26
asoc/msm-compress-q6-v2.c Normal file → Executable file
View File

@ -66,7 +66,7 @@
#define COMPR_PLAYBACK_MAX_NUM_FRAGMENTS (16 * 4)
#define COMPRESSED_LR_VOL_MAX_STEPS 0x2000
const DECLARE_TLV_DB_LINEAR(msm_compr_vol_gain, 0,
static const DECLARE_TLV_DB_LINEAR(msm_compr_vol_gain, 0,
COMPRESSED_LR_VOL_MAX_STEPS);
/* Stream id switches between 1 and 2 */
@ -190,7 +190,7 @@ struct msm_compr_audio {
spinlock_t lock;
};
const u32 compr_codecs[] = {
static const u32 compr_codecs[] = {
SND_AUDIOCODEC_AC3, SND_AUDIOCODEC_EAC3, SND_AUDIOCODEC_DTS,
SND_AUDIOCODEC_TRUEHD, SND_AUDIOCODEC_IEC61937};
@ -886,8 +886,7 @@ static void compr_event_handler(uint32_t opcode,
}
atomic_set(&prtd->eos, 0);
stream_index = STREAM_ARRAY_INDEX(stream_id);
if (stream_index >= MAX_NUMBER_OF_STREAMS ||
stream_index < 0) {
if (stream_index >= MAX_NUMBER_OF_STREAMS) {
pr_err("%s: Invalid stream index %d", __func__,
stream_index);
spin_unlock_irqrestore(&prtd->lock, flags);
@ -1577,7 +1576,7 @@ static int msm_compr_configure_dsp_for_playback
pr_debug("%s: stream_id %d\n", __func__, ac->stream_id);
stream_index = STREAM_ARRAY_INDEX(ac->stream_id);
if (stream_index >= MAX_NUMBER_OF_STREAMS || stream_index < 0) {
if (stream_index >= MAX_NUMBER_OF_STREAMS) {
pr_err("%s: Invalid stream index:%d", __func__, stream_index);
return -EINVAL;
}
@ -1823,7 +1822,7 @@ static int msm_compr_configure_dsp_for_capture(struct snd_compr_stream *cstream)
}
stream_index = STREAM_ARRAY_INDEX(ac->stream_id);
if (stream_index >= MAX_NUMBER_OF_STREAMS || stream_index < 0) {
if (stream_index >= MAX_NUMBER_OF_STREAMS) {
pr_err("%s: Invalid stream index:%d", __func__, stream_index);
return -EINVAL;
}
@ -2164,7 +2163,7 @@ static int msm_compr_playback_free(struct snd_compr_stream *cstream)
stream_id = ac->stream_id;
stream_index = STREAM_ARRAY_INDEX(NEXT_STREAM_ID(stream_id));
if ((stream_index < MAX_NUMBER_OF_STREAMS && stream_index >= 0) &&
if ((stream_index < MAX_NUMBER_OF_STREAMS) &&
(prtd->gapless_state.stream_opened[stream_index])) {
prtd->gapless_state.stream_opened[stream_index] = 0;
spin_unlock_irqrestore(&prtd->lock, flags);
@ -2174,7 +2173,7 @@ static int msm_compr_playback_free(struct snd_compr_stream *cstream)
}
stream_index = STREAM_ARRAY_INDEX(stream_id);
if ((stream_index < MAX_NUMBER_OF_STREAMS && stream_index >= 0) &&
if ((stream_index < MAX_NUMBER_OF_STREAMS) &&
(prtd->gapless_state.stream_opened[stream_index])) {
prtd->gapless_state.stream_opened[stream_index] = 0;
spin_unlock_irqrestore(&prtd->lock, flags);
@ -2258,7 +2257,7 @@ static int msm_compr_capture_free(struct snd_compr_stream *cstream)
stream_id = ac->stream_id;
stream_index = STREAM_ARRAY_INDEX(stream_id);
if ((stream_index < MAX_NUMBER_OF_STREAMS && stream_index >= 0)) {
if (stream_index < MAX_NUMBER_OF_STREAMS) {
spin_unlock_irqrestore(&prtd->lock, flags);
pr_debug("close stream %d", stream_id);
q6asm_stream_cmd(ac, CMD_CLOSE, stream_id);
@ -2330,8 +2329,7 @@ static int msm_compr_set_params(struct snd_compr_stream *cstream,
pr_debug("%s: sample_rate %d\n", __func__, prtd->sample_rate);
/* prtd->codec_param.codec.reserved[0] is for compr_passthr */
if ((prtd->codec_param.codec.reserved[0] >= LEGACY_PCM &&
prtd->codec_param.
if ((prtd->codec_param.
codec.reserved[0] <= COMPRESSED_PASSTHROUGH_DSD) ||
(prtd->codec_param.
codec.reserved[0] == COMPRESSED_PASSTHROUGH_IEC61937))
@ -2964,8 +2962,7 @@ static int msm_compr_trigger(struct snd_compr_stream *cstream, int cmd)
* called immediately.
*/
stream_index = STREAM_ARRAY_INDEX(stream_id);
if (stream_index >= MAX_NUMBER_OF_STREAMS ||
stream_index < 0) {
if (stream_index >= MAX_NUMBER_OF_STREAMS) {
pr_err("%s: Invalid stream index: %d", __func__,
stream_index);
spin_unlock_irqrestore(&prtd->lock, flags);
@ -4214,8 +4211,7 @@ static int msm_compr_adsp_stream_cmd_put(struct snd_kcontrol *kcontrol,
}
event_data = (struct msm_adsp_event_data *)ucontrol->value.bytes.data;
if ((event_data->event_type < ADSP_STREAM_PP_EVENT) ||
(event_data->event_type >= ADSP_STREAM_EVENT_MAX)) {
if (event_data->event_type >= ADSP_STREAM_EVENT_MAX) {
pr_err("%s: invalid event_type=%d",
__func__, event_data->event_type);
ret = -EINVAL;