ret = hal_camera_get_device_capability_list(new_mmcam_capability->hal_handle, &new_mmcam_capability->list);
if (ret != CAMERA_ERROR_NONE) {
MMCAM_LOG_WARNING("failed to get capability from camera HAL");
-
- if (hal_camera_deinit(new_mmcam_capability->hal_handle) != CAMERA_ERROR_NONE)
- MMCAM_LOG_WARNING("failed to deinit HAL handle");
-
- return MM_ERROR_CAMCORDER_NOT_SUPPORTED;
+ goto _RETURN_NOT_SUPPORTED;
}
__mmcamcorder_capability_check(new_mmcam_capability);
+ if (hcamcorder->device_type >= new_mmcam_capability->list.device_count) {
+ MMCAM_LOG_WARNING("device[%d] is not supported by capability[count:%d]",
+ hcamcorder->device_type, new_mmcam_capability->list.device_count);
+ goto _RETURN_NOT_SUPPORTED;
+ }
+
hcamcorder->mmcam_capability = g_steal_pointer(&new_mmcam_capability);
return MM_ERROR_NONE;
+
+_RETURN_NOT_SUPPORTED:
+ if (hal_camera_deinit(new_mmcam_capability->hal_handle) != CAMERA_ERROR_NONE)
+ MMCAM_LOG_WARNING("failed to deinit HAL handle");
+
+ return MM_ERROR_CAMCORDER_NOT_SUPPORTED;
}