Move the NULL checks for the protection configuration parameters
before dereferencing them to avoid potential NULL pointer
dereferences.
The device pointer is assumed to be valid.
No functional change intended.
Signed-off-by: Gaetan Perrot <gaetan.perrot@spacecubics.com>