acrn-hypervisor/hypervisor/include/debug
Shiqing Gao 3df3c9f6a1 hv: vuart: fix 'Shifting value too far'
MISRA-C requires that shift operation cannot exceed the word length.

What this patch does:
- Fix the bug in 'vuart_init'
  The register 'dll' and 'dlh' should be uint8_t rather than char.
  'dll' is the lower 8-bit of divisor.
  'dlh' is the higher 8-bit of divisor.
  So, the shift value should be 8U rather than 16U.
- Fix other data type issues regarding to the registers in 'struct
  vuart'
  The registers should be unsigned variables.

v1 -> v2:
 * Use a local variable 'uint8_t value_u8 = (uint8_t)value' to avoid
   mutiple times type conversion
 * Use '(uint8_t)divisor' rather than '(uint8_t)(divisor & 0xFFU)' to
   get the lower 8 bit of 'divisor'
   Direct type conversion is safe and simple per Xiangyang's suggestion.

Tracked-On: #861
Signed-off-by: Shiqing Gao <shiqing.gao@intel.com>
Reviewed-by: Junjie Mao <junjie.mao@intel.com>
2018-08-16 09:01:53 +08:00
..
console.h HV: Merge hypervisor debug header files 2018-08-14 09:54:48 +08:00
dump.h HV:treewide:Update cpu_id type as uint_16 2018-07-04 16:39:26 +08:00
logmsg.h HV: Merge hypervisor debug header files 2018-08-14 09:54:48 +08:00
sbuf.h HV:debug:fix "signed/unsigned conversion without cast" 2018-07-04 12:18:38 +08:00
trace.h hv: cpu: remove unnecessary cpu_id valid check 2018-08-02 15:21:34 +08:00
vuart.h hv: vuart: fix 'Shifting value too far' 2018-08-16 09:01:53 +08:00