From: Alex Ray Date: Wed, 27 Mar 2013 21:34:03 +0000 (-0700) Subject: libcamera2: Handle ion_alloc failures X-Git-Tag: cm-10.2-M1^2~15 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=5c664f4ce4110c37bd30fdedb79026780635f308;p=GitHub%2FLineageOS%2Fandroid_hardware_samsung_slsi_exynos5.git libcamera2: Handle ion_alloc failures Return error when failing to allocate sensor scratch buffers in device open. Bug: 8049715 Change-Id: Ib7e05e226ab08190f4bf933f8aa06ccd44758508 --- diff --git a/libcamera2/ExynosCameraHWInterface2.cpp b/libcamera2/ExynosCameraHWInterface2.cpp index 5dee2e7..82b4f1a 100644 --- a/libcamera2/ExynosCameraHWInterface2.cpp +++ b/libcamera2/ExynosCameraHWInterface2.cpp @@ -1277,10 +1277,19 @@ int ExynosCameraHWInterface2::InitializeISPChain() m_camera_info.sensor.memory = V4L2_MEMORY_DMABUF; for(i = 0; i < m_camera_info.sensor.buffers; i++){ + int res; initCameraMemory(&m_camera_info.sensor.buffer[i], m_camera_info.sensor.planes); m_camera_info.sensor.buffer[i].size.extS[0] = m_camera_info.sensor.width*m_camera_info.sensor.height*2; m_camera_info.sensor.buffer[i].size.extS[1] = 8*1024; // HACK, driver use 8*1024, should be use predefined value - allocCameraMemory(m_ionCameraClient, &m_camera_info.sensor.buffer[i], m_camera_info.sensor.planes, 1<<1); + res = allocCameraMemory(m_ionCameraClient, &m_camera_info.sensor.buffer[i], m_camera_info.sensor.planes, 1<<1); + if (res) { + ALOGE("ERROR(%s): failed to allocateCameraMemory for sensor buffer %d", __FUNCTION__, i); + // Free allocated sensor buffers + for (int j = 0; j < i; j++) { + freeCameraMemory(&m_camera_info.sensor.buffer[j], m_camera_info.sensor.planes); + } + return false; + } } m_camera_info.isp.width = m_camera_info.sensor.width;