fixup: small fix to serial module.

I have made a simple test to functions.Then got some simple problems.

Signed-off-by: Yu Mingfei <yumingfei@cn.fujitsu.com>