pp: check return value 94/173294/1
authorBoram Park <boram1288.park@samsung.com>
Tue, 20 Mar 2018 09:43:25 +0000 (18:43 +0900)
committerBoram Park <boram1288.park@samsung.com>
Tue, 20 Mar 2018 09:43:25 +0000 (18:43 +0900)
Change-Id: I83a5bdfce662cff016446a76c2bfde7e889f4e16

src/tdm_nexell_pp.c

index 8685be5caf4f72affb5d3bc1d4fdb65c695a058c..925472ef94c546d85f5db709acd039c4367480f9 100644 (file)
@@ -114,6 +114,8 @@ _tdm_nexell_pp_convert(tdm_nexell_pp_buffer *buffer, tdm_info_pp *info, int drm_
        RETURN_VAL_IF_FAIL(bo_src != NULL, TDM_ERROR_OPERATION_FAILED);
        handle_src = (__u32)tbm_bo_get_handle(bo_src, TBM_DEVICE_DEFAULT).u32;
        ctx.src_fds[0] = _tdm_gem_to_dmafd(drm_fd, handle_src);
+       RETURN_VAL_IF_FAIL(ctx.src_fds[0] >= 0, TDM_ERROR_OPERATION_FAILED);
+
        ctx.src_fds[1] = ctx.src_fds[0];
        ctx.src_fds[2] = ctx.src_fds[0];
 
@@ -155,7 +157,9 @@ _tdm_nexell_pp_convert(tdm_nexell_pp_buffer *buffer, tdm_info_pp *info, int drm_
                        ctx.dst_width, ctx.dst_height, ctx.dst_stride[0], ctx.dst_stride[1], ctx.dst_stride[2], ctx.dst_fds[0], ctx.dst_fds[1], ctx.dst_fds[2],
                        ctx.crop.x, ctx.crop.y, ctx.crop.width, ctx.crop.height);
 
-       ioctl(scaler_fd, IOCTL_SCALER_SET_AND_RUN, &ctx);
+       if (ioctl(scaler_fd, IOCTL_SCALER_SET_AND_RUN, &ctx) < 0) {
+               TDM_ERR("IOCTL_SCALER_SET_AND_RUN failed");
+       }
 
        close(ctx.src_fds[0]);
        close(ctx.dst_fds[0]);
@@ -178,7 +182,7 @@ tdm_nexell_pp_get_capability(tdm_nexell_data *nexell_data, tdm_caps_pp *caps)
                return TDM_ERROR_BAD_MODULE;
        }
 
-       caps->capabilities = TDM_PP_CAPABILITY_SYNC | TDM_PP_CAPABILITY_SCANOUT | TDM_PP_CAPABILITY_NO_CSC;
+       caps->capabilities = TDM_PP_CAPABILITY_SYNC | TDM_PP_CAPABILITY_SCANOUT;
 
        caps->format_count = NUM_PP_FORMAT;
 
@@ -295,6 +299,7 @@ nexell_pp_commit(tdm_pp *pp)
        tdm_nexell_pp_data *pp_data = pp;
        tdm_nexell_pp_buffer *b = NULL, *bb = NULL;
        tdm_nexell_data *nexell_data;
+       tdm_error ret;
 
        RETURN_VAL_IF_FAIL(pp_data, TDM_ERROR_INVALID_PARAMETER);
 
@@ -303,7 +308,8 @@ nexell_pp_commit(tdm_pp *pp)
        LIST_FOR_EACH_ENTRY_SAFE(b, bb, &pp_data->pending_buffer_list, link) {
                LIST_DEL(&b->link);
 
-               _tdm_nexell_pp_convert(b, &pp_data->info, nexell_data->drm_fd, nexell_data->scaler_fd);
+               ret = _tdm_nexell_pp_convert(b, &pp_data->info, nexell_data->drm_fd, nexell_data->scaler_fd);
+               RETURN_VAL_IF_FAIL(ret == TDM_ERROR_NONE, ret);
 
                if (pp_data->done_func)
                        pp_data->done_func(pp_data,