From 439d7bf2e86bdb768a3053038cead03c9c8c4210 Mon Sep 17 00:00:00 2001 From: Sejun Park Date: Thu, 20 Apr 2017 10:26:26 +0900 Subject: [PATCH] fixed svace issues Change-Id: Iafb7c9a459413095f21582613664876aa605cb9f --- include/exynos_v4l2.h | 2 ++ libgscaler/libgscaler.cpp | 6 +++--- libion/include/ion/ion.h | 2 ++ libion/ion.c | 7 +++++-- libv4l2/exynos_mc.c | 2 +- libv4l2/exynos_v4l2.c | 3 ++- 6 files changed, 15 insertions(+), 7 deletions(-) diff --git a/include/exynos_v4l2.h b/include/exynos_v4l2.h index 6320529..73c267a 100755 --- a/include/exynos_v4l2.h +++ b/include/exynos_v4l2.h @@ -43,6 +43,8 @@ extern "C" { #include #include /* vendor specific videodev2.h */ +#define MSG_LEN 100 + /*! \ingroup exynos_v4l2 */ int exynos_v4l2_open(const char *filename, int oflag, ...); /*! \ingroup exynos_v4l2 */ diff --git a/libgscaler/libgscaler.cpp b/libgscaler/libgscaler.cpp index 8073e80..3c4cc24 100755 --- a/libgscaler/libgscaler.cpp +++ b/libgscaler/libgscaler.cpp @@ -449,7 +449,7 @@ int exynos_gsc_run_exclusive(void *handle, int ret = 0; CGscaler* gsc = GetGscaler(handle); - if (handle == NULL) { + if (gsc == NULL) { ALOGE("%s::handle == NULL() fail", __func__); return -1; } @@ -549,7 +549,7 @@ int exynos_gsc_wait_frame_done_exclusive(void *handle) int ret = 0; CGscaler* gsc = GetGscaler(handle); - if (handle == NULL) { + if (gsc == NULL) { ALOGE("%s::handle == NULL() fail", __func__); return -1; } @@ -574,7 +574,7 @@ int exynos_gsc_stop_exclusive(void *handle) int ret = 0; CGscaler* gsc = GetGscaler(handle); - if (handle == NULL) { + if (gsc == NULL) { ALOGE("%s::handle == NULL() fail", __func__); return -1; } diff --git a/libion/include/ion/ion.h b/libion/include/ion/ion.h index 6b847e0..7085a08 100755 --- a/libion/include/ion/ion.h +++ b/libion/include/ion/ion.h @@ -26,6 +26,8 @@ __BEGIN_DECLS +#define MSG_LEN 100 + struct ion_handle; int ion_open(); diff --git a/libion/ion.c b/libion/ion.c index 403a585..0824ded 100755 --- a/libion/ion.c +++ b/libion/ion.c @@ -52,9 +52,11 @@ int ion_close(int fd) static int ion_ioctl(int fd, int req, void *arg) { int ret = ioctl(fd, req, arg); + char msg_buff[MSG_LEN]; + if (ret < 0) { ALOGE("ioctl %x failed with code %d: %s\n", req, - ret, strerror(errno)); + ret, strerror_r(errno, msg_buff, MSG_LEN)); return -errno; } return ret; @@ -94,6 +96,7 @@ int ion_map(int fd, ion_user_handle_t handle, size_t length, int prot, { int ret; unsigned char *tmp_ptr; + char msg_buff[MSG_LEN]; struct ion_fd_data data = { .handle = handle, }; @@ -112,7 +115,7 @@ int ion_map(int fd, ion_user_handle_t handle, size_t length, int prot, } tmp_ptr = mmap(NULL, length, prot, flags, data.fd, offset); if (tmp_ptr == MAP_FAILED) { - ALOGE("mmap failed: %s\n", strerror(errno)); + ALOGE("mmap failed: %s\n", strerror_r(errno, msg_buff, MSG_LEN)); return -errno; } *map_fd = data.fd; diff --git a/libv4l2/exynos_mc.c b/libv4l2/exynos_mc.c index 142c0aa..4c12b1f 100755 --- a/libv4l2/exynos_mc.c +++ b/libv4l2/exynos_mc.c @@ -255,7 +255,7 @@ static int __media_enum_entities(struct media_device *media) continue; /* Fall back to get the device name via sysfs */ - __media_get_devname_sysfs(entity); + ret = __media_get_devname_sysfs(entity); if (ret < 0) ALOGE("media_get_devname failed"); } diff --git a/libv4l2/exynos_v4l2.c b/libv4l2/exynos_v4l2.c index 3286e8d..d55efb7 100755 --- a/libv4l2/exynos_v4l2.c +++ b/libv4l2/exynos_v4l2.c @@ -519,6 +519,7 @@ int exynos_v4l2_qbuf(int fd, struct v4l2_buffer *buf) int exynos_v4l2_dqbuf(int fd, struct v4l2_buffer *buf) { int ret = -1; + char msg_buff[MSG_LEN]; Exynos_v4l2_In(); @@ -549,7 +550,7 @@ int exynos_v4l2_dqbuf(int fd, struct v4l2_buffer *buf) if (errno == EAGAIN) return -errno; - ALOGW("failed to ioctl: VIDIOC_DQBUF (%d - %s)", errno, strerror(errno)); + ALOGW("failed to ioctl: VIDIOC_DQBUF (%d - %s)", errno, strerror_r(errno, msg_buff, MSG_LEN)); return ret; } -- 2.7.4