kexec: check if memory is reserved only when loading kdump kernel.

When memory for crashkernel isn't reserved, it's confusing that kexec
spits error message for unloading kdump kernel as if we were loading it:

  # kexec -p -u
  Memory for crashkernel is not reserved
  Please reserve memory by passing "crashkernel=X@Y" parameter to the kernel
  Then try loading kdump kernel
  # echo $?
  1

It's more appropriate to test if memory is reserved only when
loading kdump kernel. With this patch:

  # kexec -p -u
  # echo $?
  0

It's also the same behavior with the case of trying to unload kernel
from unloaded state.

Signed-off-by: WANG Chao <chaowang@redhat.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
1 file changed