From: Jaechul Lee Date: Fri, 27 Sep 2024 01:54:48 +0000 (+0900) Subject: Fix coverity issues X-Git-Tag: accepted/tizen/unified/20241001.004130^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fheads%2Ftizen;p=platform%2Fadaptation%2Fap_broadcom%2Faudio-hal-bcm2837.git Fix coverity issues [Version] 0.2.3 [Issue Type] Coverity Change-Id: I3462d33bfaf9dc818cd22a5fde085bf5548b822b Signed-off-by: Jaechul Lee --- diff --git a/packaging/audio-hal-bcm2837.spec b/packaging/audio-hal-bcm2837.spec index 7f86e56..c3f527a 100644 --- a/packaging/audio-hal-bcm2837.spec +++ b/packaging/audio-hal-bcm2837.spec @@ -1,6 +1,6 @@ Name: audio-hal-bcm2837 Summary: TIZEN Audio HAL for BCM2837 -Version: 0.2.2 +Version: 0.2.3 Release: 0 Group: System/Libraries License: Apache-2.0 diff --git a/tizen-audio-file.c b/tizen-audio-file.c index d32a174..78adf01 100644 --- a/tizen-audio-file.c +++ b/tizen-audio-file.c @@ -133,14 +133,21 @@ static audio_return_e audio_file_avail(void *audio_handle, void *handle, uint32_ return AUDIO_ERR_INTERNAL; } - fseek(h->fp, 0L, SEEK_END); + if (fseek(h->fp, 0L, SEEK_END) < 0) { + AUDIO_LOG_ERROR("failed to seek 0. errno(%d)", errno); + return AUDIO_ERR_INTERNAL; + } + end = ftell(h->fp); if (end < 0) { AUDIO_LOG_ERROR("failed to get ftell(%d)", errno); return AUDIO_ERR_INTERNAL; } - fseek(h->fp, cur, SEEK_SET); + if (fseek(h->fp, cur, SEEK_SET) < 0) { + AUDIO_LOG_ERROR("failed to seek current. cur(%ld), errno(%d)", cur, errno); + return AUDIO_ERR_INTERNAL; + } *avail = (uint32_t)MAX(end - cur, 0); diff --git a/tizen-audio-impl-ctrl.c b/tizen-audio-impl-ctrl.c index 49f6373..4e571f6 100644 --- a/tizen-audio-impl-ctrl.c +++ b/tizen-audio-impl-ctrl.c @@ -115,9 +115,9 @@ audio_return_e _mixer_control_get_value(audio_hal_s *ah, const char *ctl_name, i snd_ctl_elem_value_set_id(control, id); if (snd_ctl_elem_read(handle, control) < 0) { - AUDIO_LOG_ERROR("snd_ctl_elem_read failed \n"); + AUDIO_LOG_ERROR("snd_ctl_elem_read failed"); goto close; -} + } switch (type) { case SND_CTL_ELEM_TYPE_BOOLEAN: @@ -194,7 +194,10 @@ audio_return_e _mixer_control_set_value(audio_hal_s *ah, const char *ctl_name, i snd_ctl_elem_value_set_id(control, id); - snd_ctl_elem_read(handle, control); + if (snd_ctl_elem_read(handle, control) < 0) { + AUDIO_LOG_ERROR("snd_ctl_elem_read failed"); + goto close; + } switch (type) { case SND_CTL_ELEM_TYPE_BOOLEAN: