Refactor kernel.c

It is unnecessary to assgin values to temporary variables.