From 0028536d70c79ebabf11f77cc2df965181509297 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Fri, 20 Mar 2020 00:53:51 +0200 Subject: libcamera: controls: Don't over-optimize ControlValue layout MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The ControlValue class size should be minimized to save space, as it can be instantiated in large numbers. The current implementation does so by specifying several members as bitfields, but does so too aggressively, resulting in fields being packed in an inefficient to access way on some platforms. For instance, on 32-bit x86, the numElements_ field is offset by 7 bits in a 32-bit word. This additionally causes a static assert that checks the size of the class to fail. Relax the constraints on the isArray_ and numElements_ fields to avoid inefficient access, and to ensure that the class size is identical across all platforms. This will need to be revisited anyway when stabilizing the ABI, so add a \todo comment as a reminder. Fixes: 1fa4b43402a0 ("libcamera: controls: Support array controls in ControlValue") Reported-by: Jan Engelhardt Signed-off-by: Laurent Pinchart Reviewed-by: Niklas Söderlund Reviewed-by: Kieran Bingham --- src/libcamera/device_enumerator_udev.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/libcamera/device_enumerator_udev.cpp') diff --git a/src/libcamera/device_enumerator_udev.cpp b/src/libcamera/device_enumerator_udev.cpp index 87638c59..f5a482e3 100644 --- a/src/libcamera/device_enumerator_udev.cpp +++ b/src/libcamera/device_enumerator_udev.cpp @@ -90,7 +90,8 @@ int DeviceEnumeratorUdev::addUdevDevice(struct udev_device *dev) return ret; } - addDevice(media); + if (!ret) + addDevice(media); return 0; } -- cgit v1.2.1