Fix checkpatch errors and warnings

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Fixes for variant type serialization and added a test

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>