[libcamera-devel,v2,26/32] libcamera: control_serializer: Use explicit ControlTypeNone case

Message ID 20200306160002.30549-27-laurent.pinchart@ideasonboard.com
State Accepted
Headers show
Series
  • libcamera: Add support for array controls
Related show

Commit Message

Laurent Pinchart March 6, 2020, 3:59 p.m. UTC
Replace the default case with an explicit ControlTypeNone case in
ControlSerializer::load() to catch omissions when adding new control
types.

A return statement needs to be added to the end of the function to avoid
gcc incorrectly reporting that some exit paths don't contain a return
statement. The compiler will still warn that not all cases are handled
when adding a new control type.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
---
- Add a return statement at the end of the function
---
 src/libcamera/control_serializer.cpp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Patch

diff --git a/src/libcamera/control_serializer.cpp b/src/libcamera/control_serializer.cpp
index 6c676811ebf3..edf3e5cab09f 100644
--- a/src/libcamera/control_serializer.cpp
+++ b/src/libcamera/control_serializer.cpp
@@ -361,9 +361,11 @@  ControlValue ControlSerializer::load<ControlValue>(ControlType type,
 		return ControlValue(value);
 	}
 
-	default:
+	case ControlTypeNone:
 		return ControlValue();
 	}
+
+	return ControlValue();
 }
 
 template<>